summaryrefslogtreecommitdiff
path: root/core
AgeCommit message (Collapse)Author
2016-07-27Fixup integer conversion logic.chromium/2813chromium/2812chromium/2811dsinclair
In bc8a64029f898286c3dcad3a6cecdc98ef30b139 we updated the FX_atonum logic to correctly handle integer overflow. This causes issues when parsing the Permissions flag of encrypted documents as that flag isn't encoded like other numbers. The Permissions flag is a unsigned value, and has to be treated as such since the sign bit is always set. The current logic will detect an overflow of the int value and return 0. The old logic would have detected the overflow and returned the negative result regardless. This CL updates the logic to do the string to int conversion as a uint32_t and then verifies the uint32_t value, if a sign was provided, fits within the int range, otherwise it converts it to an int and lets it be positive or negative as needed. BUG=pdfium:539 Review-Url: https://codereview.chromium.org/2168173002
2016-07-27Splitting fx_ge_fontmap.cppnpm
Move CFX_FolderFontInfo, CFX_FontMgr, and CFX_FontMapper into their own classes. There are namespaces in each of the new files, having methods from the original namespace in fx_ge_fontmap, according to what each class needs. Review-Url: https://codereview.chromium.org/2185533006
2016-07-26Use smart pointer for CPDF_Form in CPDF_Annot.jaepark
CPDF_Annot owns CPDF_Form, so use std::unique_ptr for memory management. BUG=pdfium:518 Review-Url: https://codereview.chromium.org/2189463003
2016-07-26Remove unused m_bFirstLayer in CPDF_RenderContext.jaepark
Review-Url: https://codereview.chromium.org/2183933002
2016-07-25Remove FX_FONTCACHE_DEFINEtsepez
This macro isn't buying us anything and reduces transparency. Review-Url: https://codereview.chromium.org/2179953002
2016-07-25fix text rotation for skiacaryclark
My initial guess for text rotation worked for scaled but not skewed or rotated. R=dsinclair@chromium.org,reed@google.com Review-Url: https://codereview.chromium.org/2178623002
2016-07-25Use smart pointers for CFX_Font and CFX_Type3Font classesweili
For the class owned member variables, use std::unique_ptr or std::vector for memory management. BUG=pdfium:518 Review-Url: https://codereview.chromium.org/2169793002
2016-07-24Remove CFX_Deletableweili
Change the last use of CFX_Deletable to its actual type and remove the use of CFX_Deletable. Review-Url: https://codereview.chromium.org/2178613002
2016-07-24Use actual type instead CFX_Deletableweili
Change two places that used CFX_Deletable to use actual types. This makes the type more obvious, and avoids unnecessary casts. Review-Url: https://codereview.chromium.org/2180443002
2016-07-21Fix skia build broken by commit c38cd6weili
Add back one function which is only used by Skia code. And make a couple small fixes. Review-Url: https://codereview.chromium.org/2167383002
2016-07-21Use smart pointers for graphics device classesweili
Use unique_ptr for class owned member variables. Also clean up some style issues such as removing unused functions and casting to raw pointer. BUG=pdfium:518 Review-Url: https://codereview.chromium.org/2163103002
2016-07-21Bring pdfium file in sync with chrome, fix mac buildcaryclark
This permits PDFium to build on the Mac with Skia as the backend. It builds on Linux and Windows as well. R=dsinclair@chromium.org,bungeman@google.com Review-Url: https://codereview.chromium.org/1995003002
2016-07-20Move CPDF_Annot and CPDF_AnnotList to their own header.jaepark
Review-Url: https://codereview.chromium.org/2163133002
2016-07-20Pass CPDF_Document instead of CPDF_AnnotList when constructing CPDF_Annot.jaepark
CPDF_AnnotList in CPDF_Annot is only used for getting CPDF_Document. Review-Url: https://codereview.chromium.org/2166883002
2016-07-20Clean up singleton implementationweili
Move the singleton instances into their namespaces, and use get()/getInstance() for uniform accesses. Review-Url: https://codereview.chromium.org/2154843002
2016-07-19Use smart pointers for various Jbig2 decoding contextsweili
Use unique_ptr for class owned member variables, and remove unnecessary or unused functions and member variable. BUG=pdfium:518 Review-Url: https://codereview.chromium.org/2149903002
2016-07-18Implement CGdiPrinterDriver::DrawDeviceText().chromium/2801thestig
This is sufficient to print text with GDI for PDFs generated by Chromium and cannot print any arbitrary PDF. Text that cannot be printed will be drawn as glyphs as before. BUG=409472 Review-Url: https://codereview.chromium.org/2113563003
2016-07-18Remove default params in CPDF_VariableText.dsinclair
This Cl cleans up the default params and any supporting code if necessary. Review-Url: https://codereview.chromium.org/2146993002
2016-07-18Removing default params from CFX_Edit.dsinclair
This CL removes all of the default params from CFX_Edit. They are either moved to the callsite or removed completely if unused. Review-Url: https://codereview.chromium.org/2152473002
2016-07-15Use CPDF_Dictionary::SetAtReference instead of CPDF_Dictionary::AddReference.jaepark
The definitions of CPDF_Dictionary::SetAtReference and CPDF_Dictionary::AddReference are identical, and AddReference is only used once. So remove CPDF_Dictionary::AddReference method and use CPDF_Dictionary::SetAtReference instead. Review-Url: https://codereview.chromium.org/2161453002
2016-07-13Remove RichText support from fpdfsdk/fxedit.dsinclair
This CL removes the support code for RichText from fxedit as it is currently unused. Review-Url: https://codereview.chromium.org/2146503002
2016-07-12Rename methods in CPDF_Interform.jaepark
EnableUpdateAP acutally sets s_bUpdateAP to the given parameter. So SetUpdateAP is accurate method name. Review-Url: https://codereview.chromium.org/2140423002
2016-07-12Replace void* to actual type for jbig2 context to avoid castsweili
Also clear up a few variable names and unnecessary brackets. Review-Url: https://codereview.chromium.org/2143083002
2016-07-11Use smart pointers for class owned member variablesweili
Replace raw member variables to smart pointer type to better maintain the ownership and to ease the management. BUG=pdfium:518 Review-Url: https://codereview.chromium.org/2136683002
2016-07-07set font cache if nullcaryclark
testing/corpus/fx/path/path_10_jd.pdf sets the document to null. (It can't be read at all by MacOS Preview.) This causes the font cache to also be null. In this case, get the font cache from CFX_GEModule instead. R=dsinclair@chromium.org Review-Url: https://codereview.chromium.org/2128043004
2016-07-06Change class member variables in raw pointer type into unique_ptrweili
Also did some cleanups such as removing an unused member variables and some unused structs. BUG=pdfium:518 Review-Url: https://codereview.chromium.org/2119013002
2016-07-06copy graphics state fullycaryclark
The dash parameters where not copied; the copy could point at random data and cause corpus tests to hang when testing Skia. PDFium measures text directly by calling FreeType. Turn off hinting altogether in Skia so that drawn text matches the metrics that PDFium measures. Premultiply bits retrieved from images, and check to see that the device bits are always premultiplied. Look for null graphics state and matrices. R=thestig@chromium.org,dsinclair@chromium.org BUG=pdfium:532 Review-Url: https://codereview.chromium.org/2120353004
2016-07-01Clean up parts of CPDF_CIDFont.thestig
Also remove some if statements that are always true/false. Review-Url: https://codereview.chromium.org/2094073002
2016-07-01Mac: Improve font substitution.chromium/2790chromium/2789chromium/2788chromium/2787thestig
Take the requested font weight and italicization into account when searching for fonts. For example, for a font with the face "Arial" and a weight of 700, search to see if "Arial Bold" is available. BUG=530 Review-Url: https://codereview.chromium.org/2119983002
2016-07-01Clean up CFX_MacFontInfo and surrounding code.thestig
Review-Url: https://codereview.chromium.org/2112213002
2016-06-29fix skia unit testscaryclark
Add checks to pass unit tests. R=thestig@chromium.org,dsinclair@chromium.org BUG=pdfium:525, pdfium:526, pdfium:527, pdfium:528, pdfium:529 Review-Url: https://codereview.chromium.org/2111553003
2016-06-29add local caching for skia drawscaryclark
PDFium assumes the lowest common denominator and draws many strings and paths that can be accumulated. Defer canvas->restore() calls until required because the clip changed. Defer text and path draws as long as subsequent calls concatenate additional data. Include debugging switch to allow disabling cache at compile-time while bugs are shaken out. Review-Url: https://codereview.chromium.org/2064753002
2016-06-29Disable failing embedder tests for Skia builds.thestig
BUG=pdfium:525,pdfium:526 Review-Url: https://codereview.chromium.org/2106043002
2016-06-27Fix a regression from commit f3e6851.thestig
The index calculations are wrong for a reverse iterator. Review-Url: https://codereview.chromium.org/2101723002
2016-06-27Clean up some CPDF_Font subclasses.thestig
Review-Url: https://codereview.chromium.org/2093313002
2016-06-27Simplify CPDF_TextRenderer::DrawTextString().thestig
Review-Url: https://codereview.chromium.org/2093033004
2016-06-27Double AdobeCMYK_to_sRGB speed with faster roundingbrucedawson
FXSYS_round is painfully slow on Windows. It does range checking and then calls an extremely expensive function. It ends up consuming half the CPU time when decoding the images in PDFs such as this one: https://www.ets.org/Media/Tests/GRE/pdf/gre_research_validity_data.pdf SSE can be used to optimize this: __m128 cmyk = {c * 255, m * 255, y * 255, k * 255}; uint32_t output[4]; _mm_storeu_si128((__m128i*)output, _mm_cvtps_epi32(cmyk)); but is cryptic, only works for x86/x64, and gives basically identical performance to this solution - int(c * 255 + 0.5f); The rounding behavior is not identical but in practice this rarely matters, and in this specific case it does not matter because the edge cases that vary are not hit. The three divisions at the end were changed to multiplies because profiling showed they were a significant cost. This change reduces the image-decode stalls in the PDF listed above by about 40%, making for a noticeably better experience. Further optimizations are possible but would require significantly more time and testing. BUG=617365 Review-Url: https://codereview.chromium.org/2096723003
2016-06-23Improve hint table validation checks.thestig
Check required hint table dictionary entries and make sure they: - Exist. - Are of the right type. Along the way: - Fix FX_atonum() to not have a non-const pass-by-ref param. - Simplify code in CPDF_StreamContentParser. - Make CPDF_Number::IsInteger() a const method. BUG=610555 Review-Url: https://codereview.chromium.org/2095763003
2016-06-23Use some FXSYS methods instead of duplicatingdsinclair
This CL uses the FXSYS_isDecimalDigit in place of a few custom IsDigit methods. It also creates an iswspace and some fractional math helper methods to share some code. Review-Url: https://codereview.chromium.org/2094453004
2016-06-23Remove FPDFAPI_LoadCID2UnicodeMap.dsinclair
This Cl removes FPDFAPI_LoadCID2UnicodeMap() and inlines the code into the one caller. Review-Url: https://codereview.chromium.org/2097513002
2016-06-22Remove some fx_dib functions with unused parameters.thestig
Review-Url: https://codereview.chromium.org/2075383002
2016-06-22Fix Skia GN build on Macweili
The build has been broken. This should make it compilable. Review-Url: https://codereview.chromium.org/2075343002
2016-06-22Fix memory leaks in EmbedderTest::OpenDocument().thestig
EmbedderTest::OpenDocument() does not gracefully handle the case of being called twice in a given test case. So avoid doing that. Review-Url: https://codereview.chromium.org/2088093002
2016-06-21Use FXFONT defines in place of integers.thestig
Fix nits along the way. Review-Url: https://codereview.chromium.org/2083943003
2016-06-21Move ifx_renderdevicedriver to a separate file to shareweili
Move ifx_renderdevicedriver class to its own file to share with multiple devices to reduce code duplication. Review-Url: https://codereview.chromium.org/2078783002
2016-06-20Fix clang_use_chrome_plugin for Mac and Skia buildsweili
These changes are specific to Mac and Skia builds. They are needed for these builds to compile with clang_use_chrome_plugin. BUG=pdfium:469 Review-Url: https://codereview.chromium.org/2081523002
2016-06-20Change func(void) to func()weili
Since PDFium is compiled as C++ code, the void keyword is not needed. BUG=pdfium:519 Review-Url: https://codereview.chromium.org/2084603003
2016-06-20Remove unused CFX_Font members.thestig
Review-Url: https://codereview.chromium.org/2077243002
2016-06-20Another round of fx_ge cleanup.thestig
- Clean up CFX_GEModule. - Remove duplicate #defines in fx_ge.h - Remove IsFontStyleFromCharCode() that always returns true. - Mark a FXTEXT_CHARPOS field as Mac only. Review-Url: https://codereview.chromium.org/2075333002
2016-06-20Fixup LoadImageInfo type checking.dsinclair
The ::DetectImageType method does more then just detecting the image type, it also sets up various needed structures to handle the decoding. Instead of skipping the ::DetectImageType call this CL changes the code to return early if the image check fails. This should allow us to stop working on images which do not match the required data format. BUG=chromium:621094 Review-Url: https://codereview.chromium.org/2085493002