summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi/fpdf_render
AgeCommit message (Collapse)Author
2016-02-16Split CPDF_PageObjectHolder off from CPDF_PageObjectListTom Sepez
Eventually, we're going to expose an iterator over CPDF_PageObjectList that we don't want to be inherited by the CPDF_PageObjectHolder sub-classes: page and form. Also, the operations that the object holder performs dealing with inquiring about masks and such seem beyond the scope of what a list would provide. Hence the "Holder" name. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1701073002 .
2016-02-16Rework progressive render loop.Tom Sepez
Migrating this off of CFX_PrtList depends on first making this saner. The tricky part is checking whether new objects have been added to a partially-parsed layer. The old code used to do this by keeping track of the last element in the list, and seeing if it changes. It's far simpler to keep track of the last element processed, and just keep looking for more objects after it with each pass. Fold together some duplicated blocks along the way. Remove unused EstimateProgress() method. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1699443002 .
2016-02-12Fix the way to access marked content.Wei Li
When there is no dictionary for marked content, it potientially may cause crash. But it is not happening now since 1) we now check for the returned dict parameter 2) the alloc function in pdfium does zero initialization. BUG=pdfium:67 R=thestig@chromium.org Review URL: https://codereview.chromium.org/1695633004 .
2016-02-05Combine two if/else blocks in CPDF_DIBSource::DownSampleScanline32Bit().Lei Zhang
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1671843002 .
2016-02-05Support 16-bit images in downsampler.chromium/2642Lei Zhang
The downsampler was not sampling correctly from 16-bit images, resulting in using the RRG bytes (of the RRGGBB 16-bit pixel) for RGB in the 8-bit output. Original code review: https://codereview.chromium.org/1663983002/ Original author: ballbach@google.com BUG=583804 R=ballbach@google.com Review URL: https://codereview.chromium.org/1671833002 .
2016-01-29Merge to XFA: Some cleanup of fpdf_render_loadimage.cppOliver Chang
- Generalise GetBits8() - Get rid of C-style casts. - Make CFX_DIBSource::SetDownSampleSize() non const. It's only overriden once and called in one place and it doesn't make sense for it to be const. - Get rid of a macro - Make public member vars of CPDF_DIBSource private - And others... TBR=thestig@chromium.org Original Review URL: https://codereview.chromium.org/1644403003 . (cherry picked from commit 487935f662ba4711caf1c2c06873b676fd3fba3e) Review URL: https://codereview.chromium.org/1649243002 .
2016-01-29Merge to XFA: Member function name refactoringWei Li
This is needed by Cl 1634373003 as the name collision with virtual functions will be shown as warnings on Linux. Also, it is better to use different names for different cases. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1644633003 . (cherry picked from commit d45e7a51904164fb22049f0a7a80d2a94c06936b) Review URL: https://codereview.chromium.org/1648233002 .
2016-01-26Merge to XFA: War on #defines, part 1.Tom Sepez
Contains additional XFA-specific changes. Original Review URL: https://codereview.chromium.org/1632143002 . (cherry picked from commit 66a9dc9dd65ed2b9c7ede448d046b770140f16d5) R=thestig@chromium.org Review URL: https://codereview.chromium.org/1636503006 .
2016-01-22Merge to XFA: Change _PDF_RenderItem to CPDF_RenderContext::Layer.Tom Sepez
Original Review URL: https://codereview.chromium.org/1620523002 . (cherry picked from commit d5712ac571f3487fe3f74617fdab007a11a09052) TBR=ochang@chromium.org Review URL: https://codereview.chromium.org/1624553004 .
2016-01-21Merge to XFA: Rename CPDF_PageObjects to CPDF_PageObjectListTom Sepez
Orignal Review URL: https://codereview.chromium.org/1612113003 . (cherry picked from commit 9ebc84109d7d2f7b81f06f19e5db20888e026c3b) R=ochang@chromium.org TBR=ochang@chromium.org Review URL: https://codereview.chromium.org/1612243002 .
2016-01-11Merge to XFA: Switch most min/max macros to std::min/max.Lei Zhang
Fix lint errors along the way. R=tsepez@chromium.org TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1567343002 . (cherry picked from commit 9adfbb0920a258e916003b1ee9515e97879db82a) Review URL: https://codereview.chromium.org/1577503002 .
2016-01-11Merge to XFA: Tidy up shading patternsTom Sepez
Original Review URL: https://codereview.chromium.org/1570873005 . (cherry picked from commit a07804a3b16c10fa2011ef56d1dacefb7d21e4f6) TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1577893002 .
2015-12-24Merge to XFA: Switch from nonstd::unique_ptr to std::unique_ptr.Lei Zhang
TBR=thakis@chromium.org Review URL: https://codereview.chromium.org/1547833002 . (cherry picked from commit d20dfba2ae10e8aeb328328f09da79ff904110a8) Review URL: https://codereview.chromium.org/1545183002 .
2015-12-24Merge to XFA: Fix failed JPX image renderingJun Fang
BUG=pdfium:338 R=thestig@chromium.org Review URL: https://codereview.chromium.org/1549043003 . Review URL: https://codereview.chromium.org/1549083002 .
2015-12-22Merge to XFA: Start using allowed C++11 features.Lei Zhang
TBR=dml@google.com, thakis@chromium.org Review URL: https://codereview.chromium.org/1544923002 . Review URL: https://codereview.chromium.org/1545823002 . (cherry picked from commit ba2586d2c0a50df14aa2549a0a841e1d4b9af4b6) (cherry picked from commit 87f7d29531dabfd66e547a6be31a08272ff631d5) Review URL: https://codereview.chromium.org/1542213002 .
2015-12-18Merge to XFA: CPDF_ImageLoader::Load() unused.Tom Sepez
Original Review URL: https://codereview.chromium.org/1535243002 . (cherry picked from commit b5385ba5d0c616cd4af994b2a9d674588086f75c) TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1539003002 .
2015-12-18Remove CFX_MapPtrToPtr in CFX_PageRenderCacheTom Sepez
Rename CPDF_ImageCache to CPDF_ImageCacheEntry because it represents a single entry, not the entire cache itself. Delete unused ClearRenderCache method, and merge cache entry clear() into its dtor. Fix a broken size calculation. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1539983002 .
2015-12-18Merge to XFA: CPDF_QuickStretcher unused.Tom Sepez
Original Review URL: https://codereview.chromium.org/1537103002 . (cherry picked from commit f0f6a01ee3dcb592e4eeaadaa2ea52c2fce317ba) TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1540683002 .
2015-12-17Merge to XFA: Tidy CPDF_RenderContextTom Sepez
Original Review URL: https://codereview.chromium.org/1536623004 . (cherry picked from commit 761660c4074269ac806d06c9bef70e4e9fb0eb29) TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1531423002 .
2015-12-14Merge to XFA: Get rid of most instance of 'foo == NULL'Lei Zhang
TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1520063002 . (cherry picked from commit e385244f8cd6ae376f6b3cf1265a0795d5d30eff) Review URL: https://codereview.chromium.org/1528763003 .
2015-12-14Merge to XFA: Get rid of most instance of 'foo != NULL'Lei Zhang
TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1512763013 . (cherry picked from commit e3c7c2b54348da4a6939f6672f6c6bff126815a7) Review URL: https://codereview.chromium.org/1529553003 .
2015-12-14Merge to XFA: Remove FX_BSTRC.Lei Zhang
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1521563002 . (cherry picked from commit 1956a174020686f91cd3b34294e91f4560fe45aa) Review URL: https://codereview.chromium.org/1526823002 .
2015-12-14Merge to XFA: Fix a memory leak in FPDFPageFuncEmbeddertest.Lei Zhang
TBR=dsinclair@chromium.org Review URL: https://codereview.chromium.org/1514283002 . (cherry picked from commit 1407c979a3ba8599546468d461f5403f317bddd3) Review URL: https://codereview.chromium.org/1525013002 .
2015-12-10Merge to XFA: Fix integer and bounds issues in sycc4{22,44}_to_rgb.Oliver Chang
Also clean up while we're here. BUG=557223 TBR=tsepez@chromium.org Original Review URL: https://codereview.chromium.org/1512833008 . (cherry picked from commit 08750d0400f1635ac33c3234cb11b192f31a1eeb) Review URL: https://codereview.chromium.org/1521473003 .
2015-12-10Merge to XFA: Replace several more CFX_MapPtrToPtr with std::set or std::mapTom Sepez
Original Review URL: https://codereview.chromium.org/1520643002 . (cherry picked from commit 7db2a535f163e7ce5995da12161ebd0214f0f75a) Original Review URL: https://codereview.chromium.org/1511413008 . (cherry picked from commit 168cfb7ee0f2abbd2bddb7e7d8b430a6d8c6c120) TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1515613006 .
2015-12-10Merge to XFA: Remove CFX_AffineMatrix/CPDF_MatrixTom Sepez
Review URL: https://codereview.chromium.org/1513363002 . (cherry picked from commit f32c969bce6743fca1e7ff796b54a1692d26d7f0) R=thestig@chromium.org Review URL: https://codereview.chromium.org/1519693002 .
2015-12-10Merge to XFA: Cleanup CPDF_DIBSource::LoadColorInfo() and ValidateDictParam().Lei Zhang
TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1507043004 . (cherry picked from commit d9324d8f7345d4546c06c4a9d6cd497b0f7f3ad2) Review URL: https://codereview.chromium.org/1512203003 .
2015-12-09Merge to XFA: Get rid of most uses of CFX_PtrArray.Tom Sepez
Original Review URL: https://codereview.chromium.org/1518593002 . (cherry picked from commit 035359cd8ddb555fa33b6133db4fd405e4660712) R=thestig@chromium.org TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1513103002 .
2015-11-12Merge to XFA: Remove relative includes.Lei Zhang
That refer to parent directories. TBR=dsinclair@chromium.org Review URL: https://codereview.chromium.org/1434223002 . (cherry picked from commit 22bc4227fbbda5a5e9abad2a2c0a98c04fe7f228) Review URL: https://codereview.chromium.org/1439223003 .
2015-11-12Merge to XFA: Clear decoders after the image decoder in the /Filter array.Oliver Chang
During decoding, when an image decoder is encountered, any subsequent decoders are ignored, but remain in the array. However, later on CPDF_DIBSource::ValidateDictParam expects the image decoder to be the last in the array, causing issues. A check is also added in CPDF_DIBSource::GetScanline to ensure that the calculated pitch value is <= the (4-aligned) pitch value in the cached bitmap to prevent future issues. Also cleans up some NULL usages. BUG=552046 TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1406943005 . (cherry picked from commit 182d129bcee8f7731b9bbfde0064295ad3b37271) Review URL: https://codereview.chromium.org/1436153003 .
2015-11-11Merge to XFA: Fix extraction of colour components in ↵Oliver Chang
CPDF_DIBSource::DownSampleScanline32Bit Previously, if |m_bpc| was < 8 (e.g. 4), this function may still try to access the source components as if |m_bpc| == 8. Even when it fell into the codepath that tried to do the right thing in this case, it was wrong. BUG=554151 TBR=tsepez@chromium.org Committed: https://pdfium.googlesource.com/pdfium/+/9b99615806e358fdb396d1cb162ee2e69c2a20ec Review URL: https://codereview.chromium.org/1433423002 . (cherry picked from commit e21fe98d5b5da7da01503b985b07b90c8e811689) Review URL: https://codereview.chromium.org/1441563002 .
2015-11-10Merge to XFA: Fix CalculatePitch32() issues.Tom Sepez
Original Review URL: https://codereview.chromium.org/1432073003 . (cherry picked from commit 46960a43145ab978ca3c90cb6133bb3d5600ad1d) BUG=pdfium:273 TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1424473008 .
2015-11-10Merge to XFA: Use unique_ptr and initializer lists in various render files.Lei Zhang
TBR=dsinclair@chromium.org Review URL: https://codereview.chromium.org/1436573003 . (cherry picked from commit c813e21d261c24867234107f2e2ca72e15cb2534) Review URL: https://codereview.chromium.org/1406933007 .
2015-11-10Merge to XFA: Fix relative includes within core/Lei Zhang
TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1427633010 . (cherry picked from commit 9fb27cb9797937499c9678bc74cf7846cbf5d2b8) Review URL: https://codereview.chromium.org/1438573002 .
2015-11-09Merge to XFA: Fix a leak in CPDF_Type3Font::LoadChar().Lei Zhang
TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1408063016 . (cherry picked from commit 6d9979dc685e3b67b0a6d9946376e026d75d3e47) Review URL: https://codereview.chromium.org/1418503020 .
2015-11-09Merge to XFA: Add path service to retrieve test data directory at run time ↵Wei Li
so tests can be run from any directory. Previously the tests which read test files assume the current directory is under pdfium. Running from any other directory will break the build. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1408003014 . (cherry picked from commit c0e93a9a942fe7d99800502a61d2fbb58cf9276f) Conflicts: core/src/fpdfapi/fpdf_parser/fpdf_parser_parser_embeddertest.cpp fpdfsdk/src/fpdfdoc_embeddertest.cpp testing/embedder_test.cpp testing/embedder_test.h Review URL: https://codereview.chromium.org/1411403012 .
2015-11-06Merge to XFA: Fix all relative includes to third_party.Lei Zhang
- In non-standalone builds, use the provided jpeg library. - Run gn format over all the GN files. - Also roll DEPS for buildtools to c2f2598. - And fix XFA's lack of #includes. BUG=541704 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1425153006 . (cherry picked from commit 34bb6c58fe60206a08dc0a1f37b7cfe83e8c762c) Review URL: https://codereview.chromium.org/1434543003 .
2015-10-27Merge to XFA: Give names to the shading typesDan Sinclair
Currently the shading types are referenced by number. This Cl creates and enum and updates the code to use the enum names instead of magic numbers. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1418623011 . (cherry picked from commit 468974316ed5f6b6f8e637ab2c7afedc7c2bfe6a) Review URL: https://codereview.chromium.org/1428573002 .
2015-10-27Merge to XFA: Type check the m_pShadingObj before assuming it's a stream.Dan Sinclair
The m_pShadingObj can be a stream or a dictionary depending on how it's used. This CL adds some simple type checking to make sure that the type of the object matches what we expect. BUG=chromium:547706 TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1421973004 . (cherry picked from commit 4ef782ab57979add3e3910d6bcfde6ef59f65724) Review URL: https://codereview.chromium.org/1422253002 .
2015-10-23XFA: Manually apply changes to fpdf_text.h and fx_font.h from masterTom Sepez
Driven off of https://codereview.chromium.org/1398383002/ Then make the other files as similar as possible. Note that this required changes to xfa/ code, and required adding some Set() methods. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1411833003 .
2015-10-22Merge to XFA: Add type cast definitions for CPDF_Stream.Dan Sinclair
This Cl adds ToStream, CPDF_Object::AsStream and CPDF_Object::IsStream and updates the src to use them as needed. BUG=pdfium:201 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1402413004 . (cherry picked from commit 338805f1366dcdf9a5b48cf591541cf98d7490f1) Review URL: https://codereview.chromium.org/1422513004 .
2015-10-22Merge to XFA: Add type cast definitions for CPDF_Array.Dan Sinclair
This Cl adds ToArray, CPDF_Object::AsArray and CPDF_Object::IsArray and updates the src to use them as needed. BUG=pdfium:201 R=thestig@chromium.org, tsepez@chromium.org Review URL: https://codereview.chromium.org/1417893003 . (cherry picked from commit c2bfc000e502c42c9a3017038fd9104c7997d126) Review URL: https://codereview.chromium.org/1419643005 .
2015-10-21Merge to XFA: Add type cast definitions for CPDF_Name.Dan Sinclair
This Cl adds ToName, CPDF_Object::AsName and CPDF_Object::IsName and updates the src to use them as needed. BUG=pdfium:201 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1417823005 . (cherry picked from commit 1c77edb7b34e03787605b7965784cea38ef9f1d7) Review URL: https://codereview.chromium.org/1417033004 .
2015-10-20[Merge to XFA] Revert "Revert "Add type cast definitions for CPDF_Dictionary.""Dan Sinclair
This reverts commit 937840e1722d1f2b77d80575d6e710d760662c9c. Add type cast definitions for CPDF_Dictionary. This CL adds ToCPDFDictionary type definitions and updates one file to use instead of straight casts. I had to fix two places where we'd casted off the constness of the original pointer. BUG=pdfium:201 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1420583003 . (cherry picked from commit 39869b641511c882d78e17548293cdb458c36f38) Review URL: https://codereview.chromium.org/1410343003 .
2015-10-19Merge to XFA: Refactor progressive renderer.Tom Sepez
Hand-application of diffs from https://codereview.chromium.org/1233453014/. This was an oversight, and was too old (pre-reformat) to apply cleanly. Checked against origin/master, only diffs are xfa related. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1416793002 .
2015-10-19Merge to XFA: Sanity check the values of TRUE and FALSE.Lei Zhang
Get rid of cond ? TRUE : FALSE. TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1405723003 . (cherry picked from commit aff4635dad81bc319266d9d84b81552580cd2b65) Review URL: https://codereview.chromium.org/1412793003 .
2015-10-16Merge to XFA: Fix a bunch of sign mismatch warnings.Lei Zhang
Also remove some gotos and move code into an anonymous namespace. And then do the partial revert to avoid size_t going negative. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1356373003 . Review URL: https://codereview.chromium.org/1400723002 . (cherry picked from commit d03ba8d1a5928e8f3f6bd7da063b53b0bc40abfd) (cherry picked from commit a398ca611d1925182ff6a4e8b2b43c277c364dc0) Review URL: https://codereview.chromium.org/1406373002 .
2015-10-08Merge to XFA: Various changes to JBig2 cache:Lei Zhang
- Makes the cache be per-document - Keys the cache on ObjNum and stream offset instead of keying on a pointer to the data (which can result in false cache hits). - Makes it so the cache is only used for the globals stream. - Reenable the cache. R=dml@google.com TBR=dml@google.com BUG=pdfium:207 Review URL: https://codereview.chromium.org/1380243004 . (cherry picked from commit f1b88e76134808f36f16b9e53a2e9dd89b12c8fd) Review URL: https://codereview.chromium.org/1394373002 .
2015-10-01Merge to XFA: Clean up some image decoder classes:Lei Zhang
- Use std::vector<uint8_t> instead of raw uint8_t* - Make ICodec_ScanlineDecoder::GetScanline() return const uint8_t* - Add FxFreeDeleter, use it in CCodec_ImageDataCache. - Make CCodec_ImageDataCache encapsulate its data members. TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1361053002 . (cherry picked from commit 022da0014faa103901ec107ed6a33e5ab00c7931) Review URL: https://codereview.chromium.org/1372993003 .
2015-09-29Merge to XFA: Fix blank page issue caused by too strict correction on bpcJun Fang
For bit per component (bpc), PDF spec mentions that a RunLengthDecode or DCTDecode filter shall always deliver 8-bit samples. However, some PDF files don't follow this rule. We can find that filter is RunLengthDecode but bpc is 1 in the provided test file. In this case, pdfium will correct bpc to 8 but the actual bpc is 1. It causes a failure because the data is much more than the expected. To handle this case, pdfium doesn't correct bpc to 8 when the original bpc is 1. BUG=512557 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1328213002 .