summaryrefslogtreecommitdiff
path: root/core/fpdfapi/render
AgeCommit message (Collapse)Author
2018-10-29Do bilinear interpolation for "huge" images.chromium/3596Lei Zhang
Simply downsampling produces really poor renderings. Use bilinear interpolation to make the rendering look better at the cost of being a bit slower. Roll DEPS for testing/corpus/ to 5a68e878 to pick up the updated test expectations from this CL. BUG=chromium:898443 Change-Id: Ifc5fa358a15e4674f431afcbe26e7ab70da58849 Reviewed-on: https://pdfium-review.googlesource.com/c/44651 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
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-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-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-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-24Make CPDF_PathObject::m_Path private.Lei Zhang
Change-Id: I5c42af8e9e2d6a60648d291153326aef04e4c49e Reviewed-on: https://pdfium-review.googlesource.com/c/44513 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-24Make CPDF_PathObject::m_FillType private.Lei Zhang
Change-Id: I69436316dd4a12ebdc3f09e7db3bf25c7495a4ce Reviewed-on: https://pdfium-review.googlesource.com/c/44512 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-24Make CPDF_PathObject::m_bStroke private.Lei Zhang
Remove some setters on newly constructed objects, since |m_bStroke| is already initialized to false. Change-Id: I8d04efec997226fb86091566eea96604f18680aa Reviewed-on: https://pdfium-review.googlesource.com/c/44511 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-24Start making CPDF_PathObject members private.Lei Zhang
Also move member initialization to the header. Change-Id: I557380ae774ddf887cefeb56df2a33e5b7cff8a4 Reviewed-on: https://pdfium-review.googlesource.com/c/44510 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: 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-16Make constants/ pass gn check.Lei Zhang
Change-Id: I1104d5c3c63dbf9f2f286797db842d30c75e2718 Reviewed-on: https://pdfium-review.googlesource.com/c/44077 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@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-15Make core/ pass gn check.Lei Zhang
Use allow_circular_includes_from as a crutch for now. Change-Id: Ia7a29a268e67b1fe21bed5cdd629e06fb5cc7bfb Reviewed-on: https://pdfium-review.googlesource.com/c/43992 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-12Split core/fpdfapi build rules into various sub-directories.Lei Zhang
Change-Id: I98e2e913f11ff63e70cb841de00a4f56b06ca03b Reviewed-on: https://pdfium-review.googlesource.com/c/43974 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@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-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-06Encapsulate CPDF_PageObject's rect member.Lei Zhang
At the same time, change it from 4 floats to a CFX_FloatRect. Change-Id: I00ded941723d6a264b7a17c73fd337e66b449308 Reviewed-on: https://pdfium-review.googlesource.com/c/43570 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-05Remove optional matrix parameter from CPDF_PageObject::GetBBox().Lei Zhang
Instead, add GetTransformedBBox() with a required matrix parameter and use that when the there is a matrix. Change-Id: I594f3eb6bc7e1bc3eb6aa9f66556ebb1dfdbebe1 Reviewed-on: https://pdfium-review.googlesource.com/c/43553 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-05Make CPDF_RenderStatus matrix params const-ref.Lei Zhang
Eliminate the possibility of nullptr. Change-Id: I16c3e442d78e5151330db7227bd1c1630af3d4a3 Reviewed-on: https://pdfium-review.googlesource.com/c/43531 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-10-04CPDF_VariableText::m_nHorzScale is always 100Tom Sepez
Remove the member and simplify logic in all the places this is passed. Change-Id: I39b979793fe84f0dc460261223655dd7f50555cc Reviewed-on: https://pdfium-review.googlesource.com/c/43474 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-10-02Use smart pointers in CPDF_PageRenderCache.Lei Zhang
Use std::unique_ptr and MaybeOwned, instead of manual memory management. Change-Id: I5f08abd869245fb55b7e868621369ff3ea34146f Reviewed-on: https://pdfium-review.googlesource.com/43211 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-10-02Remove dead code in CPDF_PageRenderCache::ResetBitmap().Lei Zhang
Callers only ever pass in nullptr for the bitmap parameter. Change-Id: Iefeb72a1268521a38b3d5ab4b03163b67bf35796 Reviewed-on: https://pdfium-review.googlesource.com/43210 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-09-27Shading functions should take const matrix pointers.chromium/3568chromium/3567chromium/3566chromium/3565chromium/3564Lei Zhang
Change-Id: If13cc70d3d047f255f5d289f35a8533811523146 Reviewed-on: https://pdfium-review.googlesource.com/43110 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-09-25Revert "Remove unreachable code in CPDF_DIBBase."Lei Zhang
This reverts commit 214982c4d02a720c3b1b3de121cddc62189b8848. Reason for revert: Turns out it is reachable. Original change's description: > Remove unreachable code in CPDF_DIBBase. > > The colorspace is always available when creating image decoders that use > colorspaces. > > Change-Id: I20ac75edcd614ccc1e83de262c128776e9d03eed > Reviewed-on: https://pdfium-review.googlesource.com/42872 > Commit-Queue: Ryan Harrison <rharrison@chromium.org> > Reviewed-by: Ryan Harrison <rharrison@chromium.org> TBR=thestig@chromium.org,rharrison@chromium.org BUG=chromium:888743 # Not skipping CQ checks because original CL landed > 1 day ago. Change-Id: I45903543f0e4bf2785660fb8c1e45c34febb6ecf Reviewed-on: https://pdfium-review.googlesource.com/43050 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-09-21Replace CPDF_Color::Copy() with honest-to-goodness operator=().Tom Sepez
Change-Id: Ifcce7b1e513c8859752d5248ae686bbe5349e342 Reviewed-on: https://pdfium-review.googlesource.com/42614 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-09-21Remove unreachable code in CPDF_DIBBase.Lei Zhang
The colorspace is always available when creating image decoders that use colorspaces. Change-Id: I20ac75edcd614ccc1e83de262c128776e9d03eed Reviewed-on: https://pdfium-review.googlesource.com/42872 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-09-21Validate more image values in CPDF_DIBBase.Lei Zhang
Change-Id: Ia5f72e6397ee959d897a945c4069f47c494b5511 Reviewed-on: https://pdfium-review.googlesource.com/42870 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@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-19Initialize CPDF_ImageRenderer in the header.Lei Zhang
Also add a GetRenderOptions() helper method. Change-Id: I47db7a21f55f396e08775575f6b2a48e440c2f91 Reviewed-on: https://pdfium-review.googlesource.com/42750 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-09-19Encapsulate CPDF_ImageLoader.Lei Zhang
Change-Id: Iee7ce04630fed86f651cd382a19e46b2f7ab6d61 Reviewed-on: https://pdfium-review.googlesource.com/42672 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-09-17Extract duplicate code into GetShadingSteps().Lei Zhang
Change-Id: I6761a5f7fc099807c09abacdccbb72d282252551 Reviewed-on: https://pdfium-review.googlesource.com/42604 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-09-17Encapsulate CPDF_StreamAcc::LoadAllData().Lei Zhang
Make it a private method, and add public methods so only limited combinations of LoadAllData() arguments are possible. Change-Id: I8c2220eb0e95012350858876586f7c470c40a7c3 Reviewed-on: https://pdfium-review.googlesource.com/42590 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-08-31Simplify radial shading.Henrique Nakashima
Change-Id: I3b6a386cf376a418ad64514313c791437ea54cf6 Reviewed-on: https://pdfium-review.googlesource.com/41610 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-08-31Fix radial shading when start circle is a point in the center of end circle.Henrique Nakashima
The bug also requires end circle to be tiny (radius of < 0.01). Bug: pdfium:1140 Change-Id: I2b355f44f0383334b8988fe41f82cb3f587e9909 Reviewed-on: https://pdfium-review.googlesource.com/41672 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-08-29Fix radial shading when center of start point is on the border of an end circle.Henrique Nakashima
Radial shading is done between two circles with their own centers and radii. When one has a radius of 0 and is located on or very close to the border of the other circle, a should be 0, but is not due to rounding errors unless the circles are aligned in x or y. Bug: pdfium:1140 Change-Id: Ief2efa91f3f16f7bed439aa471b258fa4d680acf Reviewed-on: https://pdfium-review.googlesource.com/41590 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-08-29Remove FPDFAPI_ prefix from internal cid/encoder functionsTom Sepez
These look too much like public/ FPDF functions otherwise and yet they are not exposed anywhere beyond core/fpdfapi. Disambiguate one method vs. top-level function usage as a result. Bug: pdfium:1141 Change-Id: I9cfdfced90386bb9ef6b2b86f568f2e6f8ee6a5a Reviewed-on: https://pdfium-review.googlesource.com/41530 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-08-28Use pdfium::span<> in more image modulesTom Sepez
Change-Id: Ie344bb37abf7dde158d03cc2897dca3588f1a5e3 Reviewed-on: https://pdfium-review.googlesource.com/41550 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-28Use std::span<> in CCodec_JPEGModuleTom Sepez
Also rename .cpp file to match class name and .h file. Modify some helper functions to operate on spans. Move some initializations to member declarations. Change-Id: Ie0889bda91daaef80fae6f5681f8ce068e92453b Reviewed-on: https://pdfium-review.googlesource.com/41534 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-08-27Use pdfium::span<> in CCodec_RLScanlineDecoderTom Sepez
Change-Id: I3dc2dd54d89858722c2aea4b9e694308796b8274 Reviewed-on: https://pdfium-review.googlesource.com/41510 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-27The final game: mark everything final.Tom Sepez
Then revert the ones that break compilation. Fix one IWYU noticed during presubmit. Change-Id: I881a8a72818e55dbc4816247e35ff5e3015194e7 Reviewed-on: https://pdfium-review.googlesource.com/41470 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-24Rename CFX_DIBSource to CFX_DIBBase.Tom Sepez
It is not a source from which you can get CFX_DIBs, but rather a base class from which all DIBs inherit. Do the same thing for the CPDF_DIBSource wrapper class. Mechanical change apart from adding a one-line comment in cfx_dibbase.h Change-Id: Id2bde87813ca301d9fafc55ce08d703dfc6a7184 Reviewed-on: https://pdfium-review.googlesource.com/41352 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-23Fix GCC build with V8 disabled.Lei Zhang
- Remove set, but otherwise unused variables. - Mark some pdfium_test code as V8-enabled only. - Do not build one unit test with GCC. Change-Id: I3f04273a7731086e08386478a62769bf06f6d8a4 Reviewed-on: https://pdfium-review.googlesource.com/41271 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-08-17Use more UnownedPtr<> in cpdf_renderstatus.h.chromium/3526Tom Sepez
This immediately flags a case where a pointer from a heap object to a caller's stack object is persisted past the caller's lifetime. Fix it the simplest way via AutoRestorer<> so we'll get a nice safe segv should it be used. Change-Id: I554304b235e73c279fa0cd79c9e3ee0138be45f9 Reviewed-on: https://pdfium-review.googlesource.com/40592 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-16Remove optional bool bType from GetFillArgb()Tom Sepez
Two variants make the intention much clearer. Change-Id: Ied0d8e6fa8c5524c19cafe8036d7c1b470fda86d Reviewed-on: https://pdfium-review.googlesource.com/40352 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-08-16Remove more optional args in core/Tom Sepez
Change-Id: I6a2bd03e00ad4e3d57f6931c0c6cf4ae0c760afb Reviewed-on: https://pdfium-review.googlesource.com/40290 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>