summaryrefslogtreecommitdiff
path: root/core/fpdfapi/render
AgeCommit message (Collapse)Author
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>
2018-08-15Make CPDF_RenderStatus::Initialize() saner.Tom Sepez
Move mandatory arguments to ctor. Replace long list of positional parameters with setter methods. Make Initialize() return void since it can't fail. Change-Id: I490118923855158891cf45eecd5de1e922a3a1fe Reviewed-on: https://pdfium-review.googlesource.com/40170 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-14Remove default args from CPDF_DIBSource::StartLoadDIBSource().Tom Sepez
Change-Id: I13f53f581487f643acf160f53d02e9af7d54cfd1 Reviewed-on: https://pdfium-review.googlesource.com/40151 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-14Remove more default arg = nullptr cases.Tom Sepez
Bring in line with standards. Remove argument entirely for mac code that is always nullptr. Change-Id: I0710bdbd51fc0bc2e1d428ef44976be39a631147 Reviewed-on: https://pdfium-review.googlesource.com/40091 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-10Remove const args and const_casts where not required.Tom Sepez
Introduce const/non-const versions of method where required. Part of the war on const_cast<>. Tidy one expression to use [] instead of .data(). Change-Id: I41e45669c79eee242ff2244c7dc3afcf6386a433 Reviewed-on: https://pdfium-review.googlesource.com/39852 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-10Add CFX_DIBSource::GetWritableScanline().Tom Sepez
Remove a bunch of const_cast<uint8_t*> or equivalent. This will also help when we convert to span<>, since casting spans is a nuisance. Change-Id: I330e5041cbaf33a84425fc4242a3dfacf5ca8011 Reviewed-on: https://pdfium-review.googlesource.com/39831 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-08-09Change CPDF_Font::GetNextChar()'s in-out parameter to pass by pointer.chromium/3518Lei Zhang
Instead of passing by non-const reference. Adjust the override in CPDF_CIDFont and CPDF_CMap::GetNextChar() as well. Change-Id: I0ee6dc21077101cbeeb0e334498075fc463a2d65 Reviewed-on: https://pdfium-review.googlesource.com/39492 Reviewed-by: Nicolás Peña Moreno <npm@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-08-07Change CPDF_Font::GetFace() to HasFace().Lei Zhang
Callers do not actually need the returned handle. Change-Id: I1b8c0be00809eb7fdae9f6e95b4b325e75f4b847 Reviewed-on: https://pdfium-review.googlesource.com/39491 Reviewed-by: Nicolás Peña Moreno <npm@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-08-04Use more text object state in DrawTextPathWithPattern().chromium/3514chromium/3513chromium/3512Lei Zhang
BUG=chromium:668762 Change-Id: Iaf3fc9bcf68b8da2c947bbd78c5d72f78195b621 Reviewed-on: https://pdfium-review.googlesource.com/35991 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-07-18Improve image size validation in CPDF_ScaledRenderBuffer.Lei Zhang
In CPDF_ScaledRenderBuffer::Initialize(), use the existing CFX_DIBitmap::CalculatePitchAndSize() function to figure out the pitch and size. Unlike the existing code, CalculatePitchAndSize() does a better job of checking for integer overflows. BUG=pdfium:1123 Change-Id: Ic8fe7226bc56fed0456486d88e02a7af2928bc94 Reviewed-on: https://pdfium-review.googlesource.com/38010 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-07-12Rename 'ori' to 'backdrop' in rendering code.Lei Zhang
Change-Id: I6fa3fd93638bc3aeaaef854676fe31476888433b Reviewed-on: https://pdfium-review.googlesource.com/37671 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-07-10Fix m_ExtGID usage in CPDF_CharPosListNicolás Peña
This CL allows Apple to use m_GlyphIndex as a replacement for m_ExtGID when it is invalid. Bug: pdfium:1121 Change-Id: I49e7936201815bae5a2c8a26680fc1e542a60c43 Reviewed-on: https://pdfium-review.googlesource.com/37390 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
2018-07-05Fix integer overflow in CPDF_Type3Cachechromium/3483Nicolas Pena
Bug: chromium:845800 Change-Id: Ib878dd991e435a76b63b662ef3d9d33c2cc61a19 Reviewed-on: https://pdfium-review.googlesource.com/37191 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-07-05Delete CPDF_ContentMark::HasRef()Henrique Nakashima
This is called by many client to make sure CountItems() does not crash. Moving the check to CountItems() makes HasRef() unnecessary. Bug: pdfium:1037 Change-Id: I4f21f33a88c9aad54f0dae18a38b370c6ceaec80 Reviewed-on: https://pdfium-review.googlesource.com/37133 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-06-29Better determine if ICC colorspaces can be used for blending.Lei Zhang
Implement CPDF_ColorSpace::IsNormal() and check it when rendering. While IsNormal() is trivial for most colorspaces, it needs to be implemented separately for ICC colorspaces. This fixes a rendering regression from commit 1c0de38c. BUG=chromium:847346 Change-Id: Iaafed3f8ee40b26ac2cbfbdf2251407f7935311b Reviewed-on: https://pdfium-review.googlesource.com/36571 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-06-26Add some more consts to unowned pointers.Tom Sepez
Ideally, unowned ptrs might well be const, as updating something through an unowned reference is best avoided. Change-Id: Ida8111ffe0ee1e30bbf6b7718b0929dfb5cafdff Reviewed-on: https://pdfium-review.googlesource.com/36050 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>