summaryrefslogtreecommitdiff
path: root/core/fxge/dib/fx_dib_main.cpp
AgeCommit message (Collapse)Author
2018-10-09Do IWYU for ptr_util.h.Lei Zhang
Change-Id: Ib96a66eb47bea791f061e1d6da8aadad8037a99d Reviewed-on: https://pdfium-review.googlesource.com/c/43609 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-05-29Get rid of FXARGB_MAKE macro.Lei Zhang
ArgbEncode() does the same thing. Change-Id: Ibb05ed4aae720c0a5ba66771699c0d7e11230921 Reviewed-on: https://pdfium-review.googlesource.com/32230 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-04-10Add static_asserts for FX_RECT and FX_COLORREF.Lei Zhang
Make sure they match their win32 equivalent data types. Change-Id: I395054ce5c5ae110c78dbae30dd985fc498045fb Reviewed-on: https://pdfium-review.googlesource.com/30070 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-03-21Add helpers to work with FXDIB_Format.Lei Zhang
Helper functions make getting the bpp and component count more readable. Change-Id: Ie0f97d52136d11ef5251f6e22748e87aea289ae1 Reviewed-on: https://pdfium-review.googlesource.com/28572 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2018-03-21Change FXSYS_RGB() to FXSYS_BGR().Lei Zhang
Also change it from a macro to a constexpr function. Change-Id: I8b2bb42c45a23da6db136abdaee24132db4471c6 Reviewed-on: https://pdfium-review.googlesource.com/28579 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-03-21Rename one ArgbEncode() variant to AlphaAndColorRefToArgb().Lei Zhang
Mark the other ArgbEncode() variant as constexpr. Change-Id: I84207d805766e5efc669638bd8a15cfead356a41 Reviewed-on: https://pdfium-review.googlesource.com/28577 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-03-20Change ArgbToColorRef() to ArgbToAlphaAndColorRef().chromium/3377Lei Zhang
Since that is what it really returns. Add a replacement ArgbToColorRef() that only returns a FX_COLORREF, and remove a duplicate implementation. Then update callers and only use ArgbToAlphaAndColorRef() where appropriate. Also update comments to explain what FX_COLORREF is. Change-Id: I5ed3d71683898dc2b3a66395dea0ec2562c14a68 Reviewed-on: https://pdfium-review.googlesource.com/28575 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2018-03-15Fixing order of guards to avoid potential segvsRyan Harrison
Per tspepez's drive by: str, in theory, might not be terminated, and might have been allocated right up to a guard page at the end of the heap, say, so that str[len] could segv. Change-Id: I6cba7b6d12b23f69e6f150c1b5296df65c2e0086 Reviewed-on: https://pdfium-review.googlesource.com/28610 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-03-15Rename FX_COLORREF variables from "rgb" to "bgr".Lei Zhang
FX_COLORREF should work like win32 COLORREF, which is BGR. Change-Id: I9f8bb3e2d30a64dc822ac6b8c46130358a03678a Reviewed-on: https://pdfium-review.googlesource.com/28574 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2018-03-12Remove all usages of FXSYS_iswASCIIspacechromium/3369Ryan Harrison
This replaces it with FXSYS_iswspace, which uses ICU to perform correct Unicode space checking. BUG=pdfium:1035 Change-Id: I7a4ed01a6b50f56a6f9d1434a7f0b01596fe42db Reviewed-on: https://pdfium-review.googlesource.com/28510 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2018-03-09Explicitly mark helper methods that only operate on ASCII rangesRyan Harrison
A number of our character helper methods take in wide character types, but only do tests/operations on the ASCII range of characters. As a very quick first pass I am renaming all of the foot-gun methods to explictly call out this behaviour, while I do a bigger cleanup/refactor. BUG=pdfium:1035 Change-Id: Ia035dfa1cb6812fa6d45155c4565475032c4c165 Reviewed-on: https://pdfium-review.googlesource.com/28330 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-01-04Remove CXFA_DataDataDan Sinclair
This CL removes the CXFA_DataData base class and the functionality is moved to where it's needed. Change-Id: Ieba31aa924b9b513466144b31f0e1613923c50aa Reviewed-on: https://pdfium-review.googlesource.com/22250 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-04-20Let {Argb,Cmyk}Decode return tuplesNicolas Pena
Change-Id: Ic4e766d9417f9a9ece5f9e4269d0f96e1e91639b Reviewed-on: https://pdfium-review.googlesource.com/4392 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-04-04Remove dib_int.hNicolas Pena
This CL removes dib_int.h by moving CStretchEngine to its own file, other classes to where they are used, and the remaining to fx_dib.h. Change-Id: Ie2d4bb39389737cd631f92b88000ea942608da21 Reviewed-on: https://pdfium-review.googlesource.com/3714 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
2017-04-04Finish splitting up fx_dib.hNicolas Pena
After this CL, fx_dib.h only has some definitions used in multiple places. Definitions that were of restricted usage were moved out to the corresponding place. Includes in fx_dib were reduced, thus revealing other needed includes. Change-Id: I3607da0af81c491256d64c0aa085225631efbdcc Reviewed-on: https://pdfium-review.googlesource.com/3594 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-04-03Split fx_dib part 5Nicolas Pena
Move more classes into their own files. Change-Id: Ic505be9e406eafb378235216ea19221ce172f32e Reviewed-on: https://pdfium-review.googlesource.com/3593 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-04-03Split fx_dib part 4Nicolas Pena
- Moved CFX_DIBitmap code to its own cpp file. - Moved CFX_DIBExtractor out from fx_dib.h Change-Id: I7b3fe9c657a350320b7ecb3f005017080491fe29 Reviewed-on: https://pdfium-review.googlesource.com/3591 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-03-31Split fx_dib part 3Nicolas Pena
Moved CFX_ImageRenderer, CFX_ImageTransformer to their own files. Change-Id: Ic98403f62bea317600a933f79946a2a9bad30eeb Reviewed-on: https://pdfium-review.googlesource.com/3551 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-03-31Split fx_dib.h part 2chromium/3059Nicolas Pena
- Created cpp for CFX_FilteredDIB. - Moved CFX_ScanLineCompositor to its own files. Change-Id: I020e44a9e824d497db4526893d61eb3819af4059 Reviewed-on: https://pdfium-review.googlesource.com/3550 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-03-31Split fx_dib part 1Nicolas Pena
Move CFX_DIBSource to its own file. Also move the classes that inherit from it to their own headers. Their cpp's will be added in followup. Change-Id: Id2b53e124ea5445c558bfcf627bf526870cc92e8 Reviewed-on: https://pdfium-review.googlesource.com/3450 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
2017-03-30Avoid one more instance of the anti-pattern in 706346.Tom Sepez
Need to have a function taking a const CFX_RetainPtr<X>& reference as an argument, assign a different object to a m_ variable of the same type in the function, continue to use the reference after the assignment, and call the function elsewhere with the same m_ variable as the argument while having no other RetainPtrs to the object. Unclear if it is called in this manner, but the first three points hold, so be proactive. Change-Id: I0ece4d7da0b8cf5f3079c53fa612ca07e9632502 Reviewed-on: https://pdfium-review.googlesource.com/3377 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-03-28Revert "Revert "Refcount all CFX_DIBSources (and subclasses) all the time.""Tom Sepez
This reverts commit 31b08d4cdaa17d7a03f35e087096a77036af98ec. Re-landing the patch after fixing skia build issue. Change-Id: Ie7039890088b803a6ec5ce365d70f57277459b48 Reviewed-on: https://pdfium-review.googlesource.com/3245 Commit-Queue: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-03-28Revert "Refcount all CFX_DIBSources (and subclasses) all the time."dsinclair
This reverts commit 0004f29bf6ee3c6060a272c79f14993e92e053c7. Reason for revert: Breaks build with skia_paths enabled (which will break the chrome roll). ../../third_party/pdfium/core/fxge/skia/fx_skia_device.cpp:1858:38: error: no member named 'get' in 'CFX_RetainPtr<CFX_DIBitmap>' ../../third_party/pdfium/core/fxge/skia/fx_skia_device.cpp:1861:42: error: no member named 'get' in 'CFX_RetainPtr<CFX_DIBitmap>' ../../third_party/pdfium/core/fxge/skia/fx_skia_device.cpp:2987:15: error: no viable overloaded '=' ../../third_party/pdfium/core/fxge/skia/fx_skia_device.cpp:2991:18: error: no viable overloaded '=' ../../third_party/pdfium/core/fxge/skia/fx_skia_device.cpp:2999:17: error: no viable overloaded '=' ../../third_party/pdfium/core/fxge/skia/fx_skia_device.cpp:3001:43: error: no member named 'GetObject' in 'CFX_RetainPtr<CFX_DIBitmap>' Original change's description: > Refcount all CFX_DIBSources (and subclasses) all the time. > > There are currently several ownership models for these objects, > including ad-hoc logic for sharing and deletion, and the > now-redundant CFX_DIBitmapRef externally-counted handle to the DIBs. > > Replace them all with the internal refcount scheme. > > Change-Id: I2db399dfc19219eda384f94cc989353b78ce2872 > Reviewed-on: https://pdfium-review.googlesource.com/3166 > Reviewed-by: dsinclair <dsinclair@chromium.org> > Commit-Queue: dsinclair <dsinclair@chromium.org> > TBR=thestig@chromium.org,tsepez@chromium.org,dsinclair@chromium.org,pdfium-reviews@googlegroups.com NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Change-Id: I678b1fbc5e666cf7a19372ebaff3270fb115ba5e Reviewed-on: https://pdfium-review.googlesource.com/3243 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-03-28Refcount all CFX_DIBSources (and subclasses) all the time.Tom Sepez
There are currently several ownership models for these objects, including ad-hoc logic for sharing and deletion, and the now-redundant CFX_DIBitmapRef externally-counted handle to the DIBs. Replace them all with the internal refcount scheme. Change-Id: I2db399dfc19219eda384f94cc989353b78ce2872 Reviewed-on: https://pdfium-review.googlesource.com/3166 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2017-02-13core: fix a few uninitialized membersMiklos Vajna
Found by Coverity when scanning the bundled pdfium-3004 in LibreOffice. This fixes: - CID 1400341: Uninitialized members (UNINIT_CTOR) CFX_ImageRenderer::m_pIccTransform - CID 1400340: Uninitialized members (UNINIT_CTOR) CPDF_CharPosList::m_nChars - CID 1400339: Uninitialized members (UNINIT_CTOR) CPDF_StreamContentParser::m_PathStartX/Y - CID 1400337: Uninitialized members (UNINIT_CTOR) CFX_ScanlineCompositor::m_pIccTransform Change-Id: Iab3862eb77be8bf379093a47f6c60ce987099982 Reviewed-on: https://pdfium-review.googlesource.com/2630 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
2016-12-14More unique_ptr returns from DIB methods.tsepez
Review-Url: https://codereview.chromium.org/2572293002
2016-12-14Return unique_ptr from GetAlphaMask.tsepez
Rename GetAlphaMask => CloneAlphaMask since it does more than get. Rename CopyAlphaMask => SetAlphaMask, as it copies IN, not OUT. ditto for CopyPalette => SetPalette. BUG= Review-Url: https://codereview.chromium.org/2572243002
2016-12-06Return unique_ptrs from CFX_DIBitmap::Clone().tsepez
Because that's what clone does. Perform immediate release in some spots to avoid disrupting too much at once. Review-Url: https://codereview.chromium.org/2534953004
2016-11-22handle antialiased rendering as premultipliedcaryclark
Transparencies and bitmap patterns need to be unpremultiplied after Skia renders them so that PDFium can use its own compositing. Also added some linear (i.e. axial) gradient support, although its unclear if any of the test corpus uses this feature. R=dsinclair@chromium.org Review-Url: https://codereview.chromium.org/2520073003
2016-11-21Fixup lint flags.Dan Sinclair
The -build/include setting was masking out build/include_what_you_use. This CL restores them, fixes any build errors, and adds NOLINT as needed. As well, the runtime/explicit and runtime/printf flags are aslo enabled and NOLINT'd. lint cleanups Change-Id: Ib013b3eb29c8d0e48cad74c5df9028684130719f Reviewed-on: https://pdfium-review.googlesource.com/2030 Reviewed-by: Tom Sepez <tsepez@chromium.org>
2016-11-17fix corpus testscaryclark
All corpus tests draw reasonably well. There are pixel differences, but no missing features or large scale errors. This was verified by running run_corpus_tests.py on skiapaths and agg build dirs, then running the skdiff tool to generate a report of the pixel difference. For example, after running $ ninja -C out/skia skdiff $ ./out/skia/skdiff /repo/pdfium/out/agg/gen/pdfium/testing/corpus/ /repo/pdfium/out/skiapaths/gen/pdfium/testing/corpus/ ~/aggskiadiffs view the report in a browser at ~/aggskiadiffs/index.html R=dsinclair@chromium.org BUG=skia:5973 Review-Url: https://codereview.chromium.org/2504863003
2016-11-02Remove FX_BOOL from coretsepez
Review-Url: https://codereview.chromium.org/2477443002
2016-10-03Add ptr_util.h from base until std::make_unique<> availabletsepez
Review-Url: https://codereview.chromium.org/2386273004
2016-09-29Move core/fxge/include to core/fxgedsinclair
BUG=pdfium:611 Review-Url: https://codereview.chromium.org/2377393002
2016-09-29Move core/fxcodec/codec/include and core/fxcodec/include files updsinclair
BUG=pdfium:611 Review-Url: https://codereview.chromium.org/2381063002
2016-09-28Replace a few more std::unique_ptr.reset() with WrapUnique assignments.thestig
And fix a typo. TBR=tsepez@chromium.org Review-Url: https://codereview.chromium.org/2382443004
2016-08-10Move CFX_RenderDevice, CFX_FxgeDevice, and CFX_GraphStateData into their own ↵npm
files. This is the third CL to separate fx_ge into classes, one per file. All fx_ge.h includes had to be replaced with new includes The method definitions for CFX_FxgeDevice were not moved to a single file. These methods are defined in two folders different from fxge/ge, so they were left untouched for now. Review-Url: https://codereview.chromium.org/2223213002
2016-08-09Fix typos of the word outer.thestig
Review-Url: https://codereview.chromium.org/2226003003
2016-08-08Move CFX_ClipRgn and CFX_PathData into their own files.npm
This is the second CL in an attempt to split up the classes in fxge/include/fx_ge.h into their own files. CFX_ClipRgn is moved to core/fxge/ge because it is only used in core/fxge. The header for CFX_PathData is left in core/fxge/include since it is used elsewhere. Review-Url: https://codereview.chromium.org/2216853004
2016-08-04Move CFX_GEModule into its own filenpm
This is the first CL in an attempt to split up the classes in fxge/include/fx_ge.h into their own files. Review-Url: https://codereview.chromium.org/2217663002
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-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-06-22Remove some fx_dib functions with unused parameters.thestig
Review-Url: https://codereview.chromium.org/2075383002
2016-06-07Get rid of NULLs in core/thestig
Review-Url: https://codereview.chromium.org/2032613003
2016-06-02The PDFium source in core/fxge/dib implements a bit-blitting backend.caryclark
This code has several disadvantages over a more modern graphics engine: - no SIMD support - no GPU support - limited quality Further, calling this code locks in the perceived resolution, so that the output cannot be scaled without additional loss. By directing all bitmap drawing through CFX_SkiaDeviceDriver::StartDIBits, Skia can handle all appropriate bitmap optimizations. To that end, SetDIBits and StretchDIBits now call StartDIBits. Other changes: Skia's bitmaps are premultiplied. PDF contains bitmaps that are unpremultiplied. PDFium appears to use premultiplied bitmaps sometimes, and unpremultiplied bitmaps elsewhere. Add a debug check for unpremultiplied bits in Skia's driver, and add a utility to premultiply PDFium's bitmaps' bits. PDFium supports a 24 bit RGB bitmap padded to a 32 bit word. Set the high byte so that Skia can treat this as an ARGB bitmap. Defer the application of the alpha value to the draw call rather than calling MultiplyAlpha where possible. Allow the destination bitmap to be alpha 8 or argb 32. Review-Url: https://codereview.chromium.org/2025043002
2016-05-26Remove default arguments from CFX_FxgeDevice.thestig
Remove unused dithering code. Review-Url: https://codereview.chromium.org/2010813003
2016-05-12Clean up CFX_ImageTransformer.thestig
Review-Url: https://codereview.chromium.org/1973913002
2016-05-11Clean up CFX_ImageStretcher.thestig
Review-Url: https://codereview.chromium.org/1968273002
2016-04-12Remove ICodec_* Interfaces.dsinclair
All of the ICodec_* interfaces had a single implementation. This CL removes the interfaces and uses the concrete classes in their place. BUG=pdfium:468 Review URL: https://codereview.chromium.org/1876023003
2016-04-06Move include/fxcodec to fxcodec/includedsinclair
Review URL: https://codereview.chromium.org/1864153002