summaryrefslogtreecommitdiff
path: root/core/src/fxge
AgeCommit message (Collapse)Author
2015-06-10Remove FX_BSTR and FX_WSTR typedefs.chromium/2434chromium/2433chromium/2432chromium/2431chromium/2430Tom Sepez
These stand for const CFX_{Byte,Wide}StringC&, which is just monumentally confusing, since there are so many string types running around here. The following had manual changes: core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp core/src/fpdfdoc/doc_form.cpp fpdfsdk/src/fpdf_ext.cpp R=thestig@chromium.org Review URL: https://codereview.chromium.org/1180593004.
2015-06-10Fix font rendering issues because of an incorrect transform.John Abd-El-Malek
This regressed in https://pdfium.googlesource.com/pdfium/+/71c24b839498fb89184002ed30fcff353e1e402c. The code would reach into FreeType internals and reset transform_flags. This would effectively set the font's transform matrix to the identity (since a transform is only used if the flag is set). I removed it because I assumed this is only a cache, and any other place that would call FT_Load_Glyph would have set a transform first. Apparently that's not the case (verified through adding some additional code). The fix is to reset the transform matrix after changing it. This is functionally equivalent to the previous behavior, since if the flag was 0 but there was a transform, it would be ignored until another transform is set. BUG=479434 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1163423005.
2015-06-10Remove typdefs for pointer types in fx_system.h.Tom Sepez
This involves fixing some multiple variable per line declarations, as the textually-substituted "*" applies only to the first one. This involves moving some consts around following the substitution. This involves replacing some typedefs used as constructors with better code. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1171733003
2015-06-09Revert 'Correct unexpected hinting fonts'JUN FANG
TBR=tsepez@chromium.org BUG=N/A Review URL: https://codereview.chromium.org/1174583003
2015-06-09Correct unexpected hinting fontsJUN FANG
If the font is 'tricky', it needs to be hinted by default according to the description in freetype. BUG=490814 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1170313003
2015-06-09Use stdint.h types throughout PDFium.Tom Sepez
It's redundant nowadays to provide our own equivalents, now that this is done for us by the system header. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1177483002
2015-06-08Remove more cruft from fx_system.hTom Sepez
- include system headers first and alphabetize. - remove unsupported FX_WIN32_MOBILE symbol. - actually define a FX_WIN64 symbol and make consistent. - use final/override, not FX_FINAL. - let stdint.h resolve FX_WORDSIZE concerns. - unused FX_ERR and FX_SUCCESS() macros. - unused FX_LSB_FIRST macro. - outline FX type deprecation plan. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1169963003
2015-05-28Fix ALL the include guards.Tom Sepez
Get rid of leading _CAPITAL identifiers. A large number of these didn't actually match the filename. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1160443004
2015-05-19Re-land: Remove FX_Alloc() null checks now that it can't return NULL.Tom Sepez
Fixes the ordering of some assignments broken when converting to checked numerics in CFX_PathData::AddPointCount(). Original Review URL: https://codereview.chromium.org/1142713005 R=thestig@chromium.org Review URL: https://codereview.chromium.org/1135893008
2015-05-19Revert "Remove FX_Alloc() null checks now that it can't return NULL."Tom Sepez
This reverts commit eb6527763171cdb4b0fbfea5a20d691f4d67b660. Reason for revert: broke javascript tests. TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1145843005
2015-05-19Remove FX_Alloc() null checks now that it can't return NULL.Tom Sepez
This permits some functions to become void's since they, in turn, can't fail. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1142713005
2015-05-18Add safe FX_Alloc2D() macroTom Sepez
This avoids unchecked multiplications when computing a size argument to malloc(). Such an overflow is very scary, and can result in exploitable bugs. Along the way, kill off some return checks, since we know this can't return NULL. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1143663004
2015-05-15Abort on OOM by default in FX_Alloc().Tom Sepez
Add a FX_TryAlloc() for those few cases where we might need to continue in face of OOM. Remove FX_AllocNL() (the context of its use would suggest that NL means "No Limit"). This is used for some big allocations, so replace it with TryAlloc(). Large allocations may be worth trying to continue from, since there are few and they have a large chance of failing. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1128043009
2015-05-14Fix another batch of compiler warnings.Lei Zhang
Also fix typos and remove trailing spaces/tabs. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1141123002
2015-05-08Fix errors from commit f0a169e.Lei Zhang
- fread() returns the number of items read. - fix a memory leak in error handling. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1135713004
2015-05-08Fix a bunch of -Wunused-but-set-variable warnings.Lei Zhang
Also fix a few nits and other errors along the way. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1098583002
2015-04-17Fix all remaining instances of FX_NEW.Tom Sepez
R=thestig@chromium.org Review URL: https://codereview.chromium.org/1084613006
2015-04-16Remove checks in fxge/{apple,win32,skia,dib} now that FX_NEW cant return 0Tom Sepez
R=thestig@chromium.org Review URL: https://codereview.chromium.org/1062863006
2015-04-16Remove checks in fxge/ge now that FX_NEW can't return 0.Tom Sepez
R=thestig@chromium.org Review URL: https://codereview.chromium.org/1081443004
2015-04-14Kill CFX_Object.Tom Sepez
CFX_Object is a type that implements its own new operators that return NULL on error. There's no need for this given the |new (std::nothrow)| syntax; in fact, the current code can only work if there is no activity in the constructors. This may explain the pervasive lack of constructors and reliance on Init() methods throughout the codebase. The activity takes place in fx_memory.h, where FX_NEW is mapped onto the std::nothrow syntax. The rest is just cleanup. Down the road, we will simply throw and remove all the error-checking paths for new objects. Landing this patch first will at least show a simple path back to the old behaviour without having to re-introduce CFX_Object should someone want to do so in their own fork. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1088733002
2015-04-02Fix uninitialized face in fx_ge_font.cppJUN FANG
MSAN reported this issue when I tried to reproduce 460936 in the last version of freetype on Linux. BUG=N/A R=thestig@chromium.org Review URL: https://codereview.chromium.org/1050333002
2015-03-30Fix no text displayed issue when font embedded and font subsetting enabledchromium/2356chromium/2355chromium/2354chromium/2353chromium/2352JUN FANG
BUG=465322 R=thestig@chromium.org Review URL: https://codereview.chromium.org/1045553004
2015-02-06Cleanup: Fix some unused-function warnings.Lei Zhang
BUG=pdfium:29 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/891113002
2015-01-30Use system FreeType on Linux.John Abd-El-Malek
This saves 406KB in the binary size of the plugin. More importantly, it gets rid of the linker flag preventing bundling PDFium into the Chromium binary. BUG=453844 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/826613004
2015-01-05Cleanup: Get rid of CRLF line endings.Lei Zhang
R=brucedawson@chromium.org Review URL: https://codereview.chromium.org/837533003
2014-12-30Get rid of FX_LPCSTR cast.Bo Xu
Follow up on https://codereview.chromium.org/733693003 R=brucedawson@chromium.org, tsepez@chromium.org Review URL: https://codereview.chromium.org/809993004
2014-12-19Update freetype to 2.5.4.Bo Xu
Put freetype into third_party directory, cleaning up header files. Previously freetype header files are in core/src/fxge/freetype and core/include/thirdparties. There were also multiple fx_freetype.h. This patch removes the additional Foxit wrapper to make further update easier. Notice, for original freetype source code, the following files are modified and need to be updated accordingly in future update: third_party/freetype/include/config/ftmodule.h third_party/freetype/include/config/ftoption.h BUG=407341 R=thestig@chromium.org Review URL: https://codereview.chromium.org/815103002
2014-12-12Fix build after previous commit.chromium/2255chromium/2254chromium/2253chromium/2252chromium/2251John Abd-El-Malek
TBR=tsepez Review URL: https://codereview.chromium.org/804463003
2014-12-12Simplify PDFium by removing code that's not used in the open source repo.John Abd-El-Malek
-remove parameter from FPDF_InitLibrary -remove a bunch of ifdefs that are unused R=tsepez@chromium.org Review URL: https://codereview.chromium.org/801913002
2014-11-14Fix build warning on android under stricter compilation rules.Tom Sepez
Error is "converting to non-pointer type 'FX_DWORD'". TBR=bo_xu@foxitsoftware.com Review URL: https://codereview.chromium.org/726033002
2014-11-10Fix a bug when performing StretchDIBits on bit maskBo Xu
BUG=401988 R=vitalybuka@chromium.org Review URL: https://codereview.chromium.org/618073003
2014-10-30Undo an old change in freetype to account for size of USHORTBo Xu
BUG=418582 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/680833006
2014-10-14Glyph index is out of range in cff_get_glyph_name.Jun Fang
Glyph index shall be less than number of glyphs. BUG=418585 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/652363002
2014-09-15Add a boundary check before accessing the table of 'Index to Location'Jun Fang
Before this fix, only |gindex < face->num_locations| is checked. However, the pointer, p, will be moved to next location in the first FT_NEXT_ULONG or FT_NEXT_USHORT. It may cause a crashier. So a boundary check is needed before the second FT_NEXT_ULONG or FT_NEXT_USHORT. BUG=412457 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/571833002
2014-08-28Remove unused fields and stack locals.Chris Palmer
Edge closer to getting PDFium to build in chromium_code mode. BUG=https://code.google.com/p/pdfium/issues/detail?id=29 R=bo_xu@foxitsoftware.com Review URL: https://codereview.chromium.org/437343002
2014-08-22Bounds check in CFX_Font::LoadGlyphPath().Tom Sepez
Add a check to CFX_Font::LoadGlyphPath() similar to the one that exists in CFX_FaceCache::RenderGlyph(). Also replace some scattered magic numbers in the file with constants, and make arrays not used outside this file be statically scoped. BUG=406144 R=jun_fang@foxitsoftware.com Review URL: https://codereview.chromium.org/497863002
2014-08-22Don't stretch bitmaps if destination size is empty.Vitaly Buka
BUG=405201 R=bo_xu@foxitsoftware.com Review URL: https://codereview.chromium.org/474093003
2014-08-13Add FX_OVERRIDE and use it for virtual functions of FX_FINAL classes.Tom Sepez
Should there be cases where this fails to compile, it indicates a mistake, either an incorrectly declared overrriden virtual method, or a method that should be declared non-virtual. The only issues were with CPDF_CustomAccess::GetBlock(), CPDF_CustomAccess::GetByte(), and CPDF_CustomAccess::GetFullPath(). These don't appear to be used anywhere, and are removed. Two members are removed that are no longer needed once those methods are removed. R=jam@chromium.org, jun_fang@foxitsoftware.com Review URL: https://codereview.chromium.org/454983003
2014-08-12Fix missing or broken include guard macros in pdfium headers.Tom Sepez
This has no ill-effect at present, but may be distracting when viewing the file since it just looks wrong. R=jun_fang@foxitsoftware.com Review URL: https://codereview.chromium.org/461933003
2014-07-31Fix for min/max compile error on WindowsScott Graham
Patch from jschuh@chromium.org. BUG=pdfium:31 TBR=jschuh@chromium.org,thakis@chromium.org Review URL: https://codereview.chromium.org/438843003
2014-07-31Fix integer overflow when stretch bitmapBo Xu
When an image object is zoomed in by a big factor, the scaling factor in the transformation matrix is big as well, resulting in a large |dest_width| and |dest_height| value(they can be think of as the equivalent pixel size of the entire image, although most of it is outside the device). BUG=395636 R=vitalybuka@chromium.org Review URL: https://codereview.chromium.org/432543002
2014-07-30Remove a few unused variables, functions, and member variables.Nico Weber
No intended behavior change. BUG=pdfium:29 R=bo_xu@foxitsoftware.com Review URL: https://codereview.chromium.org/426763003
2014-07-29Fix a few more warnings in chromium_code mode.Nico Weber
No intended behavior change. - Remove more unused variables, functions, member variables. - Put a few constructor initializers in the order they execute in. - Add braces for subobject initializers. - Fix a handful of signed / unsigned comparisons. BUG=pdfium:29 R=bo_xu@foxitsoftware.com Review URL: https://codereview.chromium.org/429593005
2014-07-29Remove a few unused variables, functions, and tables.Nico Weber
Found by clang's -Wunused-variable, -Wunused-function, -Wunused-const-variable. BUG=none R=bo_xu@foxitsoftware.com Review URL: https://codereview.chromium.org/404653005
2014-07-21Fix remaining -Wdelete-non-virtual-dtor violations on Windows.Nico Weber
Follow-up to https://codereview.chromium.org/370853002/ BUG=none R=bo_xu@foxitsoftware.com Review URL: https://codereview.chromium.org/406683005
2014-07-18Fix pdfium building issue on VS2010chromium/2098Jun Fang
BUG=pdfium_23 R=palmer@chromium.org Review URL: https://codereview.chromium.org/399233002
2014-07-18pdfium: Fix all -Wdelete-non-virtual-dtor violations on Mac.Nico Weber
Calling `delete` on an object of a type that has virtual functions but not a virtual destructor is questionable: Since the object has virtual functions, it likely has subclasses, so if it's deleted through the base pointer and the destructor isn't virtual, the subclass destructor won't be called. In most cases, the classes getting deleted can just be marked final to tell the compiler that it can't possibly have subclasses (this also enables the compiler to generate better code). Two classes didn't have any sub- or superclasses but virtual functions - this doesn't make sense, so make all methods of these classes non-virtual. (Also delete an unused function on one of the two classes.) In one case, a class actually did have a subclass that needs to be deleted virtually, so mark one destructor as virtual. BUG=none R=bo_xu@foxitsoftware.com Review URL: https://codereview.chromium.org/370853002
2014-07-16Remove uninitialized const global g_GbFontNameMap.Nico Weber
C++11 makes uninitialized const PODs an error, because they contain uninitialized memory (they're uninitialized that can never be initialized (because they're const). In this case, the memory was only used by _GetSubFontName() if the lang parameter was 1, but _GetSubFontName() is only called from one place, with a lang parameter of 0. So remove _GetSubFontName()'s lang parameter too. (Using bsearch for searching an array that always has exactly 2 entries is overkill too, but I'm trying to keep the diff small.) No intended behavior change. Fixes this error on the clang/win bot: ..\..\third_party\pdfium\core\src\fxge\win32\fx_win32_device.cpp(207,20) : error(clang): default initialization of an object of const type 'const _FontNameMap [1]' const _FontNameMap g_GbFontNameMap[1]; ^ BUG=chromium:82385 R=bo_xu@foxitsoftware.com Review URL: https://codereview.chromium.org/369343003
2014-07-14Fix an out-of-boundary issue for wide stringBo Xu
BUG=381521 R=palmer@chromium.org Review URL: https://codereview.chromium.org/383563002
2014-07-08Remove custom memory managerBo Xu
BUG= R=palmer@chromium.org Review URL: https://codereview.chromium.org/372473003