summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp
AgeCommit message (Collapse)Author
2016-03-10Split fpdf_parser_objects.cpp into per-class .cpp/.h files.Tom Sepez
R=dsinclair@chromium.org Review URL: https://codereview.chromium.org/1776913007 .
2016-03-10Change colorspace's number of components to be unsignedWei Li
Also remove unnecessary casts. BUG=pdfium:29 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1783933002 .
2016-03-08Split off CPDF_Document into its own .cpp/.h files.Tom Sepez
R=dsinclair@chromium.org Review URL: https://codereview.chromium.org/1780503002 .
2016-02-23Remove uses of this->foo.Lei Zhang
R=weili@chromium.org Review URL: https://codereview.chromium.org/1722913002 .
2016-02-17Expand all paths to be based off pdfium/ directoryDan Sinclair
This CL runs a script over the source and updates the include files to be a full path from the pdfium/ directory. BUG=pdfium:65 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1707923002 .
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-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 .
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-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-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-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-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: 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-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-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-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 .
2015-09-03Merge to XFA: Reapply Foxit's libopenjpeg modifications.Lei Zhang
They were lost in commit d53e6fd. BUG=pdfium:168 TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1196523002 . (cherry picked from commit 870b5b6793fa261f0c6f31f026010d2d715968bf) Review URL: https://codereview.chromium.org/1301323007 .
2015-09-03Merge to XFA: Cleanup dead code in CPDF_DIBSource::LoadJpxBitmap() and friends.Lei Zhang
TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1310603006 . (cherry picked from commit 097297325e0d3d00556d67885547750a2e9d4b32) Review URL: https://codereview.chromium.org/1305223010 .
2015-08-20Merge to XFA: Fix some -Wmaybe-uninitialized errors.Lei Zhang
- Break up CPDF_DIBSource::DownSampleScanline() into smaller functions. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1287843004 . (cherry picked from commit 9ae9ae2a68439cbc84a719c0dacf6984703e77cb) Review URL: https://codereview.chromium.org/1304873002 .
2015-08-14Merge to XFA: Don't bother checking pointers before delete[] and FX_Free().Lei Zhang
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1297713003 . (cherry picked from commit cb62e7657b3a9a04142028a4e6614029a08e894b) Review URL: https://codereview.chromium.org/1287053005 .
2015-08-04XFA: clang-format all pdfium code.Nico Weber
No behavior change. Generated by: find . -name '*.cpp' -o -name '*.h' | \ grep -E -v 'third_party|thirdparties|lpng_v163|tiff_v403' | \ xargs ../../buildtools/mac/clang-format -i Then manually merged https://codereview.chromium.org/1269223002/ See thread "tabs vs spaces" on pdfium@googlegroups.com for discussion. BUG=none
2015-07-23Merge to XFA - else after returns.Tom Sepez
(cherry picked from commit 3c012fef2bb72c8ec1faa73e11ee35539b2559d6) Original Review URL: https://codereview.chromium.org/1243953004 . R=thestig@chromium.org Review URL: https://codereview.chromium.org/1239313005 .
2015-06-13Remove trailing whitespaces in core, XFA edition.Lei Zhang
Review URL: https://codereview.chromium.org/1180333002.
2015-06-11Merge to XFA: Kill FXSYS_mem{cpy,cmp,set.move}{32,8}.Tom Sepez
Only manual merge was core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp follwed by scripts. Original Review URL: https://codereview.chromium.org/1179693003. TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1179953002.
2015-06-10Merge to XFA: Remove FX_BSTR and FX_WSTR typedefs.Tom Sepez
Nearly automatic merge + re-run script on new files. Original Review URL: https://codereview.chromium.org/1180593004. TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1174303002.
2015-06-10Merge to XFA: Remove typdefs for pointer types in fx_system.h.Tom Sepez
Original Review URL: https://codereview.chromium.org/1171733003 R=thestig@chromium.org Review URL: https://codereview.chromium.org/1178613002.
2015-06-09Merge to XFA: Use stdint.h types throughout PDFium.Tom Sepez
Near-automatic merge, plus re-running scripts to update additional usage. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1172793002
2015-06-08Merge to XFA: Fix potentially massive memory leak in ↵Lei Zhang
CPDF_DIBSource::LoadJpxBitmap(). Leaks can happen in several places. For this particular bug, it happens when there is a colorspace component count mismatch. BUG=497191 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1153633009 (cherry picked from commit 2a824f1c0ed786aed0dd15a0ea60dc90999e2b2c) Review URL: https://codereview.chromium.org/1168833002
2015-06-04Merge to XFA: Move fx_safe_types.h to include/ directory.Tom Sepez
Original Review URL: https://codereview.chromium.org/1147353006 TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1152693005
2015-05-20Merge to XFA: Remove FX_Alloc() null checks now that it can't return NULL.Tom Sepez
Original Review URL: https://codereview.chromium.org/1142713005 R=thestig@chromium.org TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1143663008
2015-05-06Merge to XFA: Replace FX_NEW with new, remove tests from fpdfapiLei Zhang
Very few places where a change is required, but remove FX_NEW to show they've been audited. Review URL: https://codereview.chromium.org/1075953004 (cherry picked from commit 5c357a5d3d873be6b0ab01d7bec82f79d0a09f0e) R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1125183006
2015-05-06Merge to XFA: Fix a regression with cut off images.Lei Zhang
This regressed in commit 3f41851 due to shadow variables. BUG=478164 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1101443004 (cherry picked from commit 97d10aff654e42c1b7c3d2abf33fbcf8d341799e) Review URL: https://codereview.chromium.org/1127163003
2015-02-27Merge to XFA: Fix JPX image rendering that regressed due to several security ↵Lei Zhang
fixes. Original Review URL: https://codereview.chromium.org/892553002 (cherry picked from commit 254360730190cc6d6e3de325ee101948b78c1e32) Review URL: https://codereview.chromium.org/967773002
2015-02-27Merge to XFA: Fix some typos in fpdf_render_loadimage.cpp.Lei Zhang
Original Review URL: https://codereview.chromium.org/885223004 (cherry picked from commit 900d7bf46efc26e0588e1777759f7716ed4f8dbd) Review URL: https://codereview.chromium.org/963413002
2015-02-27Merge to XFA: Cleanup: Fix some unused-function warnings.Lei Zhang
Original URL: https://codereview.chromium.org/891113002 (cherry picked from commit 44fc192f29a77c5864fabffe5ab63937dacdfd21) Review URL: https://codereview.chromium.org/966023002