summaryrefslogtreecommitdiff
path: root/core/fxge
AgeCommit message (Collapse)Author
2018-10-26Replace int flags with struct FXDIB_ResampleOptions.Lei Zhang
Using bit values in an int may not be reliable, since different parts of the code can interpret the bits differently. e.g. FXDIB_DOWNSAMPLE and RENDER_FORCE_DOWNSAMPLE are defined in different places, but can be used interchangeably because they just happen to have the same value. It works but is rather fragile. Instead, use a struct of bools to explicitly define what different bits mean. Remove FXDIB_DOWNSAMPLE and friends. Change-Id: I9cf0c8f94d1ed27edf8dba22b0ab0ee67f2722cc Reviewed-on: https://pdfium-review.googlesource.com/c/44650 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-26Include platform-specific fxge sources with conditionals.Lei Zhang
Change-Id: I3d83818d3b2e1485dbb5cddbda1273b510450920 Reviewed-on: https://pdfium-review.googlesource.com/c/44694 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-26Fix more nits in fx_win32_gdipext.cpp.Lei Zhang
- Use reinterpret_cast in more places. - Return data from a function with pdfium::Optional and std::pair. Change-Id: Ia6b8af985ece52a20b00aa80166c61f57b7b8478 Reviewed-on: https://pdfium-review.googlesource.com/c/44630 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-26Implement CFX_RenderDevice::GetFlipMatrix().Lei Zhang
Consolidate matrix transforms from several places. Change-Id: I2febcaed69afd1cf3eabf68f27ffe24301f07ca2 Reviewed-on: https://pdfium-review.googlesource.com/c/44631 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-26Forward declare a bunch of classes.Lei Zhang
Then do IWYU to fix up build errors. Move some implementations out of headers to allow more forward declarations. Change-Id: Idbeb978705a21cd6fb710ca9f5e99b4ea7d93ec5 Reviewed-on: https://pdfium-review.googlesource.com/c/44632 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-25Simplify some code in CGdiDisplayDriver.Lei Zhang
- GDI_StretchBitMask(), which is not an override, has a flags parameter that is never used. Remove it. - StretchDIBits() checks its flags parameter and does an early return, but still continue to use it afterwards when its only possible value is 0. Replace the flags variable with 0. Change-Id: Iad63557a1c28f2b5b84260a6b5498c1d7beada7f Reviewed-on: https://pdfium-review.googlesource.com/c/44611 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-25Pass source rect parameter to SetDIBits() by const-ref.Lei Zhang
In RenderDeviceDriverIface() implementations. Change-Id: Ic5e0239a29e7fa7b70e9ef65c82df7e773f8e363 Reviewed-on: https://pdfium-review.googlesource.com/c/44610 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-25Remove rarely used GDI+ using statements.chromium/3592Lei Zhang
Change-Id: I139393e39980fa3ea0aa9389153f65e43e39cd6c Reviewed-on: https://pdfium-review.googlesource.com/c/44555 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-25Remove unused GDI+ code.Lei Zhang
Change-Id: Ie31e657b8f5630ccd5306cf37235af2944d1eee5 Reviewed-on: https://pdfium-review.googlesource.com/c/44554 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-25Change DrawBitsWithMask() to take a matrix by const-ref.Lei Zhang
In CFX_SkiaDeviceDriver. Change-Id: Ie19c258fdffc0844b2210aec484b7e71a5ba52d0 Reviewed-on: https://pdfium-review.googlesource.com/c/44553 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-25Change StartDIBits() to take a matrix by reference.Lei Zhang
In RenderDeviceDriverIface and related classes, and for related methods in the call stack. Change-Id: I420fafe70084eb3941dffc6f9f51ecbed79581de Reviewed-on: https://pdfium-review.googlesource.com/c/44552 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-25Change FXDIB_BLEND_FOO typedefs to an enum class.Lei Zhang
BUG=pdfium:1085 Change-Id: Ieb43d4588e1d689e327e428dcbbf7adba45ce178 Reviewed-on: https://pdfium-review.googlesource.com/c/44545 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-25Fix blend mode usage in CFX_ScanlineCompositor helpers.Lei Zhang
- Remove FXDIB_BLEND_NONSEPARABLE, which is not a real blend type. - Change implicit if (blend_type) conditions to check against FXDIB_BLEND_NORMAL. - Add an IsNonSeparableBlendMode() helper. Change-Id: If5c017a7851ad928d1f17688bf6e9c38f70f4e0e Reviewed-on: https://pdfium-review.googlesource.com/c/44551 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-25Initialize SkiaState members where declared.Lei Zhang
Change-Id: I7bd85d2559bf30ccae3c8595cc37e613d4d4a2a2 Reviewed-on: https://pdfium-review.googlesource.com/c/44550 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-25Initialize CFX_ImageRenderer members in the header.Lei Zhang
- Reorder to pack a bit better. - Remove |m_BlendType| which is always |FXDIB_BLEND_NORMAL|. - Change the ctor to pass the matrix by reference. Change-Id: I07870947915fd2c90f28502803eb17f18204ac92 Reviewed-on: https://pdfium-review.googlesource.com/c/44547 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-24Clean up CFX_ImageTransformer parameters.Lei Zhang
- A valid matrix is always passed in, so make the parameter const-ref. Since it is not obvious who owns the passed in matrix, make a copy with the corresponding matrix member. - Since the matrix parameter is const-ref, CFX_DIBBase::TransformTo() can also have a const-ref matrix parameter. - |flags| should be uint32_t, since |m_Flags| is. - |pClips| is only used inside the ctor, so remove |m_pClip|. Change-Id: If3d58a3fd28fa72b4ac7caac15f49a8057c594db Reviewed-on: https://pdfium-review.googlesource.com/c/44541 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-24Remove FXDIB_BLEND_UNSUPPORTED.Lei Zhang
The blend mode is never set to this value. Change-Id: I96cbadb055137a9de45f0082c81a7b8aedb9a427 Reviewed-on: https://pdfium-review.googlesource.com/c/44544 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-23Test color.convert() and equal() from JS (and fix comparison logic).Tom Sepez
Currently, color.equal(a, b) may not give the same result as color.equal(b, a) since arg1 is converted to be the type of arg2, and some of these conversions lose information. Instead promote to the type with the most components in the hope of preserving the most information. Better error message when there are the right number of parameters but the types are wrong. Change-Id: I1d93fa29db4fb65e0f7c07c3ba7d9ca87ebf7bc9 Reviewed-on: https://pdfium-review.googlesource.com/c/44413 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-22Remove third arg to CFX_DIBitmap::LoadChannel()chromium/3589Tom Sepez
It is always passed as FXDIB_Alpha. Rename method to indicate its new purpose, and remove dead code. Change-Id: Ifaf4faa6b25d1cbd2ff272309764b49de70dc836 Reviewed-on: https://pdfium-review.googlesource.com/c/44491 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-16Add FxFileCloser for scoped FILE* closing.Lei Zhang
Change-Id: Ic3791e1ddbdc9d30407c8f747fd11e0e338e83d4 Reviewed-on: https://pdfium-review.googlesource.com/c/44090 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-16Use unique_ptr in CFX_FolderFontInfo::ScanFile().chromium/3583Lei Zhang
Change-Id: If98589e8daffdc74a72281cec6726fb54878e185 Reviewed-on: https://pdfium-review.googlesource.com/c/44076 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-16Use more unique_ptrs in cfx_psrenderer.cpp for FaxCompressData().Lei Zhang
Change-Id: I2a1f03b7336f2b03ef1d4bbbd396e7a2c5bdea50 Reviewed-on: https://pdfium-review.googlesource.com/c/43999 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-16Make {A85,RunLength}Encode()'s buffer out parameter a unique_ptr.Lei Zhang
Change-Id: I3f06ea7ed39c8a8fff57e07f14ff6c21bedbc028 Reviewed-on: https://pdfium-review.googlesource.com/c/43998 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-15Split pdfium_embeddertests sources.chromium/3582Lei Zhang
Move foo_embeddertest.cpp to the same BUILD.gn file as foo.cpp. Set up dependencies to make pdfium_embeddertests pass gn check. Change-Id: If1fe67c261960c35c344c1047950cd7fdb32c4a1 Reviewed-on: https://pdfium-review.googlesource.com/c/43997 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-15Move fx_skia_device_unittest.cpp to pdfium_embeddertests.Lei Zhang
It uses fpdfsdk/ and public/ code from core/. Also sort some conditionals in BUILD.gn. Change-Id: I4da9dc1f1833fa6644be3da1a935beba1d57cb2f Reviewed-on: https://pdfium-review.googlesource.com/c/43996 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-15Split pdfium_unittests sources.Lei Zhang
Move foo_unittest.cpp to the same BUILD.gn file as foo.cpp. Set up dependencies to make pdfium_unittests pass gn check. Change-Id: Id9f649d5d0c76fe4254f3887778516abb75fcbce Reviewed-on: https://pdfium-review.googlesource.com/c/43995 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-15Make fxjs/ pass gn check.Lei Zhang
Use allow_circular_includes_from as a crutch for now. Change-Id: I8c53bafd864048506a77354f57e27cac50369005 Reviewed-on: https://pdfium-review.googlesource.com/c/43989 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-15Make FlateEncode()'s buffer out parameter a unique_ptr.Lei Zhang
Change-Id: I31a5abb3c8dd31826098493f51effbd5afe109d1 Reviewed-on: https://pdfium-review.googlesource.com/c/41856 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-12Split core/fxcrt build rules into core/fxcrt/BUILD.gn.Lei Zhang
Change-Id: I9b3608bd76ec4911a4bb820fcda62c5d9533fb4f Reviewed-on: https://pdfium-review.googlesource.com/c/43947 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-12Remove more unnecessary includes and do IWYU as needed.Lei Zhang
Also move some implementations out of headers. Change-Id: I321fc26970c440d874b135bd28e8bc8156b9afee Reviewed-on: https://pdfium-review.googlesource.com/c/43890 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-12Split most core build rules into various BUILD.gn files in core.Lei Zhang
Change-Id: I773eec2bbf104f073eba7a64ed19f6fba0131d21 Reviewed-on: https://pdfium-review.googlesource.com/c/43946 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-10-12Rename CPDF_{Array,Dictionary}::GetCount() to size().Lei Zhang
Make them compatible with pdfium::CollectionSize(). Change-Id: Ibef3b182e35a7eca7c656cf590462782de0cc157 Reviewed-on: https://pdfium-review.googlesource.com/c/43937 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-09Do IWYU for retain_ptr.h and unowned_ptr.hLei Zhang
Change-Id: I2897feee27f80c85f0328f0b220ae5be93686170 Reviewed-on: https://pdfium-review.googlesource.com/c/43610 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-09Do IWYU for ptr_util.h.Lei Zhang
Change-Id: Ib96a66eb47bea791f061e1d6da8aadad8037a99d Reviewed-on: https://pdfium-review.googlesource.com/c/43609 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-04Change |virtual ~Foo(){}| to |virtual ~Foo()=default;|chromium/3571Tom Sepez
Otherwise code coverage flags the empty body as unreachable. Change-Id: Iee1d9a876d68276529c70d9b8c7a28276f271767 Reviewed-on: https://pdfium-review.googlesource.com/c/43514 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-04Refer to const smart pointers consistently.Lei Zhang
SmartPtr<T> const m_Ptr, instead of const SmartPtr<T> m_Ptr. Change-Id: I8001b0334543f49d138a24438def62088a15c6e4 Reviewed-on: https://pdfium-review.googlesource.com/c/43512 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-04Remove more uncalled methods in core/Tom Sepez
Change-Id: I10679c9d28eb495c6bc21fd1355cb3ef330a1209 Reviewed-on: https://pdfium-review.googlesource.com/c/43471 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-10-03Add FxFolderHandleCloser for use with std::unique_ptr.Lei Zhang
Use it in a couple of places. Make the similar code in the two places even more so. Change-Id: I3fc6a567088217e24506cdf7ab927b94cb5a4d52 Reviewed-on: https://pdfium-review.googlesource.com/43330 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-01Fix #include ordering / formatting.Lei Zhang
Change-Id: I996c9b32d767960a5388e44e13180e1f6577ce38 Reviewed-on: https://pdfium-review.googlesource.com/43190 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-09-25Add FxAlignToBoundary<>() template helper function.Tom Sepez
Because I nearly botched this trivial calculation in the previous CL. Change-Id: I7438f9d3476d93b7899c2d7d761234769f53f9e3 Reviewed-on: https://pdfium-review.googlesource.com/43010 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-09-24Give CFX_GraphStateData a work-over.chromium/3561Tom Sepez
Use std::vector<float> for dash array. Use compiler-generated default operations. Squeeze some enums. Fix obvious logic botch in DashChanged(). Change-Id: If1d809cc46a3cf2db98a09a3f5a49d22138c0640 Reviewed-on: https://pdfium-review.googlesource.com/42613 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-09-20Remove extraneous 'extern "C"' entries.Lei Zhang
Also remove dead code found along the way, and fix lint errors. BUG=pdfium:410 Change-Id: I4cd0ede516483209cf49a6686d909953ab196106 Reviewed-on: https://pdfium-review.googlesource.com/42771 Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-09-20Fix misc lint errors and other cleanups.Lei Zhang
Change-Id: I00ce0109251d1231858e87ffc3889abe6937fa26 Reviewed-on: https://pdfium-review.googlesource.com/42811 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-09-20Remove many unneeded STL #includes from headers.Lei Zhang
Change-Id: I7010cedee8d17d05b2c37a94d767e6f3a9c48f7d Reviewed-on: https://pdfium-review.googlesource.com/42790 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-09-17Fix final/protected conflicts.Tom Sepez
Classes marked |final| should not have |protected| members. In turn, "private field m_dwEncryptObjNum is not used" warning is produced. Change-Id: I51a96aca5a5f499381a6764d892962f7f2dc0327 Reviewed-on: https://pdfium-review.googlesource.com/42611 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-09-15Remove FXFM_ENCODING_NONE.Lei Zhang
FX_CreateFontEncodingEx() always passes FXFM_ENCODING_NONE. Just get rid of it instead. Change-Id: I417f84d8ae2f10ba874265a92576d3ef8481a9d6 Reviewed-on: https://pdfium-review.googlesource.com/42460 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-09-14Use UnownedPtr in CFX_UnicodeEncoding.Lei Zhang
Change-Id: I410909be359a5b5bb0c90d42064144771183525e Reviewed-on: https://pdfium-review.googlesource.com/42461 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-09-12Avoid out of bound access in ClipAngledGradient().chromium/3551Lei Zhang
BUG=chromium:835667 Change-Id: I3b9fd04d26f1baa30d48f938616b187410134b5f Reviewed-on: https://pdfium-review.googlesource.com/42311 Reviewed-by: Cary Clark <caryclark@google.com> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-09-12Fix pdf_use_skia_paths build after commit 048d7f7c.Lei Zhang
There is missing build coverage, apparently. Change-Id: Ibaf3a8d3f478eca6ab683bdcf0d7a91eeddafde3 Reviewed-on: https://pdfium-review.googlesource.com/42290 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-08-30Use pdfium::span<> arg in A85 and RLE encoder methodsTom Sepez
Change-Id: Iff900bc3e1cd9c9dd6b023230c1feba78759581c Reviewed-on: https://pdfium-review.googlesource.com/41710 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>