summaryrefslogtreecommitdiff
path: root/core
AgeCommit message (Collapse)Author
2017-07-12support m_bGlyph_AdjustCary Clark
Skia has no direct match for a different 2x3 matrix per glyph -- if the 2x3 is a square scale with rotation, we can do that with RSX transforms. The bug used the 2x3 to do a condensed face, which we can do with SkPaint::setTextScaleX. Otherwise, we draw a character at a time. R=dsinclair@chromium.org,npm@chromium.org Bug: 736703 Change-Id: I8f14fd63ffdaee886b63d1154b771f9de092a83f Reviewed-on: https://pdfium-review.googlesource.com/7272 Commit-Queue: Cary Clark <caryclark@google.com> Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-07-12Remove unused methods from CPDF_ColorSpaceNicolas Pena
Change-Id: Idbed9a2061d9d25ab12f8caaa09fe5ddba93cff7 Reviewed-on: https://pdfium-review.googlesource.com/7670 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-07-12Added helper functions in the class CPDF_FileSpecJane Liu
1. Added two helper functions in CPDF_FileSpec, which will be useful when adding support for embedded files: CPDF_FileSpec::GetFileStream() - useful because the stream object contains the file's data CPDF_FileSpec::GetParamsDict() - useful because the params dictionary contains parameters of the file, such as creation date, size, etc. * Added two unit tests testing both functions. Bug=pdfium:174 Change-Id: I33ea21ddb621434007f94767f281ead0b00ecb8a Reviewed-on: https://pdfium-review.googlesource.com/7355 Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Jane Liu <janeliulwq@google.com>
2017-07-12Move CMYKtoRGB methods to fx_codec and clean them upNicolas Pena
This CL moves CMYKtoRGB methods to fx_codec. It also cleans them up a bit, including allowing them to return tuples instead of having non-const refs in their parameters. Change-Id: Ib3ec45102ec7eff623cd07a624e852d39bf335e4 Reviewed-on: https://pdfium-review.googlesource.com/7591 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-07-12Cleanup ICC code part 1Nicolas Pena
This CL switches void* to CLcmsCmm*, simplifies the ownership and destruction of CLcmsCmm, and reduces unnecessary function calling in fx_codec_icc.cpp. Change-Id: Ifdbf59dcdaede497d1684b161dd066726cf08ee3 Reviewed-on: https://pdfium-review.googlesource.com/7590 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
2017-07-11Cleanup CFX_RenderDeviceNicolas Pena
This CL adds some helper namespace methods and cleans up methods. Change-Id: I7ef51dd1ff365d307694a10519d532698ee39211 Reviewed-on: https://pdfium-review.googlesource.com/7550 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-07-11Add Windows generic / text only printer driver support.rbpotter
BUG=chromium:734850 Change-Id: Icc0947e2e99e77a36d8963fcf0b6d3deea161d3e Reviewed-on: https://pdfium-review.googlesource.com/7194 Commit-Queue: Rebekah Potter <rbpotter@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-07-10Roll FreeType to c56d8851ea987023cc73981a70d261b3f6427545chromium/3156chromium/3155chromium/3154Nicolas Pena
Bug: chromium:738919 Change-Id: I2ea99a47f45e2e68650bd1fa9ad7554d8df79874 Reviewed-on: https://pdfium-review.googlesource.com/7351 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
2017-07-10Move core/fxge/ge to core/fxge.Dan Sinclair
This brings the cpp and h files together and removes the redundant ge/ path. Change-Id: I36594b8ae719d362768ba4c2e4ce173e287363eb Reviewed-on: https://pdfium-review.googlesource.com/7452 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-07-10Reland "typeface double delete"Dan Sinclair
This reverts commit 75e1ab05e731d99b9acdc86de47640720e848415. Reason for revert: Using the custom skia smart pointer is the correct approach over CFX_UnownedPtr. Original change's description: > Revert "typeface double delete" > > This reverts commit ddf2418ba8e5d925909d7955ac22b33f37ccce44. > > Reason for revert: not right > > Original change's description: > > typeface double delete > > > > SkTypeface was doubly deleted at pdfium teardown > > SkTypeface has two pointers but no owners. > > Making the font cache an owner fixes the bug but > > violates checkdeps rules. Let me know what to > > do about that. > > > > R=​dsinclair@chromium.org,npm@chromium.org > > Bug: 736133 > > Change-Id: I756a41258a5ac86e70139d7a587c5da9bb7a707b > > Reviewed-on: https://pdfium-review.googlesource.com/7270 > > Reviewed-by: Nicolás Peña <npm@chromium.org> > > Commit-Queue: Cary Clark <caryclark@google.com> > > TBR=dsinclair@chromium.org,caryclark@google.com,npm@chromium.org,caryclark@skia.org > > Change-Id: I255f50acf2cbaecc85b8e5ac3893c1fbc77b6492 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: 736133 > Reviewed-on: https://pdfium-review.googlesource.com/7310 > Reviewed-by: Cary Clark <caryclark@google.com> > Commit-Queue: Cary Clark <caryclark@google.com> TBR=dsinclair@chromium.org,caryclark@google.com,npm@chromium.org,caryclark@skia.org # Not skipping CQ checks because original CL landed > 1 day ago. Bug: 736133 Change-Id: I0ab949e9da2fdab9559e7ffe0ceed24d8eb9b66a Reviewed-on: https://pdfium-review.googlesource.com/7510 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-07-07core: fix -Wshadow warningschromium/3153Miklos Vajna
Found with this patch: diff --git a/BUILD.gn b/BUILD.gn index 83bad1b13..444685f04 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -89,6 +89,8 @@ config("pdfium_core_config") { "/wd4324", "/wd4577", ] + } else { + cflags += [ "-Wshadow" ] } } But renaming the conflicting names is tricky, so done with clang-rename. Change-Id: Ie959b86e9e82b11b211761b0c73e439e51044de7 Reviewed-on: https://pdfium-review.googlesource.com/7410 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-07-07Check that there is enough data remaining in source BMP before readingchromium/3152Ryan Harrison
When reading in a BMP, after processing the header, make sure that there is enough data remaining in the source before proceeding. If not signal that the BMP is improperly formatted. BUG=chromium:738635 Change-Id: I506bc0e6db7dcd4b5984fd91a1f39516320a2037 Reviewed-on: https://pdfium-review.googlesource.com/7280 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-07-07Convert c-style casts in fx_memory.h into static_castsRyan Harrison
Change-Id: I53da7a36ce8503abd99f2525e8a5b394ee547b47 Reviewed-on: https://pdfium-review.googlesource.com/7353 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-07-06Revert "typeface double delete"Cary Clark
This reverts commit ddf2418ba8e5d925909d7955ac22b33f37ccce44. Reason for revert: not right Original change's description: > typeface double delete > > SkTypeface was doubly deleted at pdfium teardown > SkTypeface has two pointers but no owners. > Making the font cache an owner fixes the bug but > violates checkdeps rules. Let me know what to > do about that. > > R=​dsinclair@chromium.org,npm@chromium.org > Bug: 736133 > Change-Id: I756a41258a5ac86e70139d7a587c5da9bb7a707b > Reviewed-on: https://pdfium-review.googlesource.com/7270 > Reviewed-by: Nicolás Peña <npm@chromium.org> > Commit-Queue: Cary Clark <caryclark@google.com> TBR=dsinclair@chromium.org,caryclark@google.com,npm@chromium.org,caryclark@skia.org Change-Id: I255f50acf2cbaecc85b8e5ac3893c1fbc77b6492 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: 736133 Reviewed-on: https://pdfium-review.googlesource.com/7310 Reviewed-by: Cary Clark <caryclark@google.com> Commit-Queue: Cary Clark <caryclark@google.com>
2017-07-05typeface double deletechromium/3150Cary Clark
SkTypeface was doubly deleted at pdfium teardown SkTypeface has two pointers but no owners. Making the font cache an owner fixes the bug but violates checkdeps rules. Let me know what to do about that. R=dsinclair@chromium.org,npm@chromium.org Bug: 736133 Change-Id: I756a41258a5ac86e70139d7a587c5da9bb7a707b Reviewed-on: https://pdfium-review.googlesource.com/7270 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: Cary Clark <caryclark@google.com>
2017-07-05additional clip debuggingCary Clark
Add debugging for bounding clip boxes Add debugging to dump save count (probably not useful) Make debugging output easier to find R=dsinclair@chromium.org,npm@chromium.org Bug: Change-Id: I4b985b8810c80a3061a11401e26a065d17236604 Reviewed-on: https://pdfium-review.googlesource.com/7278 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Cary Clark <caryclark@google.com>
2017-07-05maintain ClipBoxCary Clark
GetClipBox returned wrong clip bounds Found tracing through looking for other bugs. GetClipBox is used by graphics outside of Skia so it needs to be kept up to date. R=dsinclair@chromium.org,npm@chromium.org Bug: 736703 Change-Id: I2b3fdfe91053848243e5b486a2615a233654c5a9 Reviewed-on: https://pdfium-review.googlesource.com/7274 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: Cary Clark <caryclark@google.com>
2017-07-05set clip rectCary Clark
clip rect should mirror existing construction Also found tracing. Keep the clip rect in sync with its expected value for compatibility. R=dsinclair@chromium.org,npm@chromium.org Bug: 736703 Change-Id: I57bab209f5e1febb5fbcd91860b43296063f1f80 Reviewed-on: https://pdfium-review.googlesource.com/7275 Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: Cary Clark <caryclark@google.com>
2017-07-05show original text to aid in debuggingCary Clark
disabled by default R=dsinclair@chromium.org,npm@chromium.org Bug: Change-Id: Iab08a7120d28b2d81a5e1d4768fd95a460208ebf Reviewed-on: https://pdfium-review.googlesource.com/7277 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Cary Clark <caryclark@google.com>
2017-07-05fix fuzzer generated out of rangeCary Clark
I could not get this to reproduce. It was also reported in April, but I marked it fixed because I couldn't reproduce this then, either. I suspect that the result of LineSide() is +/-inf, causing either minBounds or maxBounds in ClipAngledGradient() to be set to -1, triggering the stack buffer misread. R=dsinclair@chromium.org,npm@chromium.org Bug: 736574 Change-Id: Id828321f8c5481b862822be43d76a41dd8e74ef0 Reviewed-on: https://pdfium-review.googlesource.com/7273 Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org> Commit-Queue: Cary Clark <caryclark@google.com>
2017-07-05clip save off by oneCary Clark
Code around this bug was altered in April to fix the off by one bug, but somehow the loop counter fix was overlooked. R=dsinclair@chromium.org,npm@chromium.org Bug: 736195 Change-Id: I583a9f2389e6111ae1b847b961afaafd5e854810 Reviewed-on: https://pdfium-review.googlesource.com/7276 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Cary Clark <caryclark@google.com>
2017-06-30Use the right free function for ICC color profiles.chromium/3146Chris Palmer
They are allocated with |opj_malloc| (which is just |malloc|), but we were freeing them with |FX_Free|. But |FX_Free| recently changed to be |PartitionFree|. This is probably not the right ultimate fix, but it should solve the high-occurence crash we're seeing in the short term. BUG=chromium:737033 Change-Id: Ia162fe4e39731bd774d3eccb2357d9add26aa079 Reviewed-on: https://pdfium-review.googlesource.com/7230 Commit-Queue: Chris Palmer <palmer@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-06-30Remove hand rolled bsearch from HTMLSTR2CodeRyan Harrison
BUG=pdfium:786 Change-Id: I0779dccb6db0e6ea3933279914153ef7961d9a5b Reviewed-on: https://pdfium-review.googlesource.com/7152 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-06-30Remove pointless CFX_FloatRect construction.Lei Zhang
Also just call CFX_FloatRect() instead of explicitly writing out all zeros. Change-Id: I7574e64791d0c9ba613b14d0a613737dfbf39b12 Reviewed-on: https://pdfium-review.googlesource.com/7172 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-06-29Basic APIs and tests for extracting and setting annotation pathsJane Liu
1. Added APIs for retrieving existing annotation paths and setting annotation paths. * Added an embedder test testing all the new functions. Bug=pdfium:737 Change-Id: Ic451bcd3be488261baf2182549c4238b887b219e Reviewed-on: https://pdfium-review.googlesource.com/6676 Commit-Queue: Jane Liu <janeliulwq@google.com> Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-06-29Move Start to constructor in CFX_Image(Renderer|Transformer)chromium/3145Nicolas Pena
The bool returned by Start was not being used and the method was always called right after the constructor, so it should be in the constructor. Change-Id: I98abf9f7c11fbe42b3aa15ec5e46731198aa23d5 Reviewed-on: https://pdfium-review.googlesource.com/7151 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-06-29Change SetReverse to GetInverse in CFX_MatrixNicolas Pena
CFX_Matrix::GetInverse is much clearer. Change-Id: Id10ab1723735332e1a78de853f28415ec3a4d834 Reviewed-on: https://pdfium-review.googlesource.com/7090 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
2017-06-28Add << overload for CFX_StringCTemplate classeschromium/3144Ryan Harrison
BUG=pdfium:790 Change-Id: I4a3623dc0daac6ff8407c09cd00e9f2e4e5dd2d7 Reviewed-on: https://pdfium-review.googlesource.com/7051 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-06-28Set default graphics before generating page contentsNicolas Pena
In this CL, the content generator sets some default graphics states before processing the page objects. In particular, a default ExtGState is now set before processing, and the last CTM is now stored right after parsing finishes: the only command to change matrix is ctm, and it concatenates, so inverting requires knowing the current value. Bug: pdfium:779 Change-Id: I35b1c07550ce91839fb0e20fbf717e3e80c9b9d6 Reviewed-on: https://pdfium-review.googlesource.com/7070 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-06-28Keep all trailers in CPDF_Parser in m_TrailersNicolas Pena
This CL removes m_pTrailer in favor of having them all in a vector, and having an index that points to the position of the previous m_pTrailer in the vector. Bug: pdfium:787 Change-Id: Ieebbf4849f7ea78f8f74d188e3adb3446a53482e Reviewed-on: https://pdfium-review.googlesource.com/7040 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
2017-06-28Converting CFX_ByteTextBuf to ostringstream in cpvt_generateap.cppHenrique Nakashima
https://pdfium-review.googlesource.com/c/7033/ contains the changes in the corpus tests expected pngs. They are imperceptible and due to a difference in float rounding when writing the appearance stream. Bug: pdfium:731 Change-Id: I815ca5b9ddd02382b74285a32bfde8bd3e8eeaae Reviewed-on: https://pdfium-review.googlesource.com/7010 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-06-28Add << overload for CFX_WideStringRyan Harrison
BUG=pdfium:788 Change-Id: I9f211d42e60c0d8b7b3c508d340036a3b26542dd Reviewed-on: https://pdfium-review.googlesource.com/7041 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-06-28Use new overloads to make usages of ostringstream more readable.Henrique Nakashima
Bug: pdfium:731 Change-Id: I92077971aec6bada061ed101cb48abe1611050d7 Reviewed-on: https://pdfium-review.googlesource.com/7042 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-06-27Made existing annotation APIs to work with APchromium/3143Jane Liu
1. Modified some existing annotation APIs to take into account the effect of annotation's appearance streams. * Added an embedder test testing annotations with APs. This CL is refactored out of https://pdfium-review.googlesource.com/c/6676/. Bug=pdfium:737 Change-Id: I27d5e66dfdb90038d147cab1a26e0bf86b324982 Reviewed-on: https://pdfium-review.googlesource.com/7030 Commit-Queue: Jane Liu <janeliulwq@google.com> Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-06-27Add overload for CPDF_Stream.SetData() that takes an ostringstream.Henrique Nakashima
Bug: pdfium:731 Change-Id: Ie65bafc644cff076b0d7aadcc5d0b0e33e2c199b Reviewed-on: https://pdfium-review.googlesource.com/7035 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-06-27Add empty string test case for ostream << CFX_ByteString.Henrique Nakashima
Change-Id: I1f3933709ad4a4f251a634dbe6d87a541994f02e Reviewed-on: https://pdfium-review.googlesource.com/7037 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2017-06-27Converting CFX_ByteTextBuf to ostringstream in cfx_fontmapper.cpp.Henrique Nakashima
Bug: pdfium:731 Change-Id: I9453f28a17dd34908e6dcc97ea27e5ee84eda2d1 Reviewed-on: https://pdfium-review.googlesource.com/7011 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-06-27Modified CPDF_PageContentGenerator to work with both Form and PageJane Liu
CPDF_PageContentGenerator currently only works for CPDF_Page objects. However, CPDF_Form is also a CPDF_PageObjectHolder like CPDF_Page, and content streams can be generated for form objects too. This CL modifies the content generator to work with both forms and pages. The content generator will later be used on annotation objects' CPDF_Form to simplify the code for annotation AP stream generation. Change-Id: I1c50bdf0329d1f5788db23286ac72750355a10ed Reviewed-on: https://pdfium-review.googlesource.com/6837 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-06-27Adding overload for ostream << CFX_ByteStringHenrique Nakashima
Bug: pdfium:731 Change-Id: I285332c8f9d988327e8633cb0746af2b76c401e5 Reviewed-on: https://pdfium-review.googlesource.com/6911 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-06-23Cleaning up fx_string_testhelpers.Henrique Nakashima
This is unused except for being a pathway for indirect deps. Change-Id: I717290235ccbc59429ad24231033382958e2a086 Reviewed-on: https://pdfium-review.googlesource.com/6910 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2017-06-22Continue BMP decoder cleanupNicolas Pena
This CL replaces raw pointers with vector and unique_ptr. It also fixes other nits. Change-Id: I45c99c9aa658681ec3f0b48fc4f407b278b250f5 Reviewed-on: https://pdfium-review.googlesource.com/6830 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-06-22Avoid regenerating appearance stream when already present.Henrique Nakashima
Since cpdfsdk_widget.cpp already generates it, we can expect that FPDF_GenerateAP will not be called. That implementation does not work with widgets with a shared field. Bug: chromium:733528 Change-Id: Ia436b4e8bc87ca86b67a02cf7301ac2328339128 Reviewed-on: https://pdfium-review.googlesource.com/6752 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2017-06-22Add a |gGeneralPartitionAllocator| and use it in the |FX_*Alloc| wrappers.chromium/3142chromium/3141chromium/3140chromium/3139Chris Palmer
BUG=pdfium:690 Change-Id: I922279e4bdc8b411f47f49798155e8f9118c1396 Reviewed-on: https://pdfium-review.googlesource.com/6552 Commit-Queue: Chris Palmer <palmer@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2017-06-22Minor change to AP generation logicJane Liu
Current behavior: Our CPVT_GenerateAP::Generate*AP() functions do not get called as long as the annotation dictionary has an "AP" entry. Problem: We always need the "N" entry in AP dictionary to display an annotation. Even though the spec requires "AP" dictionary to have an "N" entry for normal mode appearance, in case of a malformed pdf with "AP" but without "N" in "AP", we won't be able to display the annotation at all. Fix: Always check if "AP" has "N" entry to decide whether AP needs to be generated. If not, then we still need to generate AP, and add to the AP dictionary under the key "N". Bug=pdfium:778 Change-Id: Icf0c6a681b3c8c22b0b67bf8d16ce6fefdc2c45b Reviewed-on: https://pdfium-review.googlesource.com/6692 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Jane Liu <janeliulwq@google.com>
2017-06-21Clamp instead of checked_cast in TT2PDFNicolas Pena
Bug: chromium:727938 Change-Id: I85fe329c9d19c1dd1303279b0a9aade2fcc3211c Reviewed-on: https://pdfium-review.googlesource.com/6814 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-06-21Fixed optional content not rendered when OCGs array is empty.chromium/3138Henrique Nakashima
At least one nonnull entry needs to be in OCGs for it to be considered present. See "OCGs" in table 4.49 in the PDF 1.7 spec. Bug: pdfium:491. Change-Id: I7eae65ba1fabff9cf1d5cea50d059a04814a3fec Reviewed-on: https://pdfium-review.googlesource.com/6751 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-06-20Cleanup fpdf_parser_decodeNicolas Pena
This CL fixes some nits in fpdf_parser_decode, especially avoiding non-const reference parameters. Change-Id: Ibb914850afd924bb398f886ac862f7589519ef7e Reviewed-on: https://pdfium-review.googlesource.com/6750 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-06-20Fix signedness of height in BMP decoderNicolas Pena
Change-Id: I8a17739538a9ecd63d713007550177579c0b72f0 Reviewed-on: https://pdfium-review.googlesource.com/6731 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-06-20Cleanup tiling and shading patterns in correct orderDan Sinclair
When a Shading is created we have both a ShadingPattern and a ShadingObject. The ShadingPattern is a ref-counted object that is stored in the CPDF_DocPageData. The ShadingObject, when we have a tiling pattern parent, is stored in the CPDF_Form of the tiling pattern. Currently during destruction it is possible for the ShadingPattern to get cleaned up before the ShadingObject which causes the UnownedPtr probe to fire. This CL loops over all patterns and for each Tiling pattern forces the CPDF_Form to get cleared. This then removes the ShadingObject before we remove the ShadingPattern. Bug: chromium:728992 Change-Id: Ife65607aa97f69440b03028981b5575b1e297093 Reviewed-on: https://pdfium-review.googlesource.com/6651 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
2017-06-19Add heuristic for improving text rendering in CPDF_CharPosList::LoadNicolas Pena
This CL uses the following algorithm for improving substitute font spacing (we are assuming the text layout is horizontal): * Calculate PDFWidth, the width that the PDF says the glyph should have. * Calculate FTWidth, the width calculated by freetype for the glyph, using the substitute font that we'll use to render it. Note that some embedded fonts have PDFWidth == FTWidth + 1, so we consider that to be matching widths. * If PDFWidth > FTWidth + 1 , move the x coordinate by the difference / 2 so that the glyph is rendered in a more centered spot and the text looks better. * If PDFWidth < FTWidth, transform the glyph horizontally by PDFWidth / FTWidth so that the glyph gets compressed and does not overlap with surrounding glyphs. Bug: chromium:431507 Change-Id: Ia378344253fabe44d93af4daab98bb3b7bca22de Reviewed-on: https://pdfium-review.googlesource.com/6630 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>