aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/PDFPrimitivesTest.cpp
Commit message (Collapse)AuthorAge
...
* SkPDF: Move SkFlate into src/pdf (part 1/3) [reland]Gravatar halcanary2015-08-12
| | | | | | | | Rename to SkDeflate so Chromium builders continue to work Next, we change remove SkFlate from Chromium build files, then we can delete SkFlate. Review URL: https://codereview.chromium.org/1285913002
* SkPDF: clean up overuse of SK_SUPPORT_PDFGravatar halcanary2015-08-11
| | | | | | | When possible use run-time checks (via SkDocument::CreatePDF) When PDF is disabled, do not compile tests/PDF*.cpp Review URL: https://codereview.chromium.org/1278403006
* SkPDF: allow PDF module to be disabled in DM and SampleAppGravatar halcanary2015-08-11
| | | | | | | | | | | To disable PDF: GYP_DEFINES='skia_pdf=0' bin/sync-and-gyp ninja -C out/Debug dm SampleApp When disabled, SkDocument::CreatePDF() always returns NULL. Review URL: https://codereview.chromium.org/1279123007
* SkPDF: clean up uses of deprecated calls in testsGravatar halcanary2015-05-01
| | | | | | BUG=skia:3585 Review URL: https://codereview.chromium.org/1106163002
* SkPDF: Refactor SkPDFObject heiararchy.Gravatar halcanary2015-04-25
| | | | | | | | | | | Flatten and use a tagged union type Δmemory ~= -2.4% ± 0.5% Δtime ~= -1.2% ± 0.2% BUG=skia:3585 Review URL: https://codereview.chromium.org/1069103003
* SkPDF: Remove Array's unused set(i) and get(i) (leaving only append())Gravatar halcanary2015-04-08
| | | | | | BUG=skia:3585 Review URL: https://codereview.chromium.org/1071583003
* SkPDF: Factor SkPDFCatalog into SkPDFObjNumMap and SkPDFSubstituteMapGravatar halcanary2015-03-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | Motivation: Keep separate features separate. Also, future linearization work will need to have several objNumMap objects share a substituteMap. Also "catalog" has a specific meaning in PDF. This catalog did not map to that catalog. - Modify SkPDFObject::emitObject and SkPDFObject::addResources interface to requiore SkPDFObjNumMap and SkPDFSubstituteMap. - SkPDFObjNumMap const in SkPDFObject::emitObject. - Remove SkPDFCatalog.cpp/.h - Modify SkDocument_PDF.cpp to use new functions - Fold in SkPDFStream::populate - Fold in SkPDFBitmap::emitDict - Move SkPDFObjNumMap and SkPDFSubstituteMap to SkPDFTypes.h - Note (via assert) that SkPDFArray & SkPDFDict don't need to check substitutes. - Remove extra space from SkPDFDict serialization. - SkPDFBitmap SkPDFType0Font SkPDFGraphicState SkPDFStream updated to new interface. - PDFPrimitivesTest updated for new interface. BUG=skia:3585 Review URL: https://codereview.chromium.org/1049753002
* SkPDF: remove SK_NO_FLATE & dead code in SkPDFStreamGravatar halcanary2015-03-31
| | | | | | | | | | | | SkPDFStream copy constructor SkPDFStream Substitute mechanism SkPDFStream::setData(NULL); SkPDFStream SK_NO_FLATE logic BUG=skia:3585 TBR=bsalomon@google.com,reed@google.com Review URL: https://codereview.chromium.org/1041183002
* C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla}Gravatar mtklein2015-03-25
| | | | | | | | | NOPRESUBMIT=true BUG=skia: DOCS_PREVIEW= https://skia.org/?cl=1037793002 Review URL: https://codereview.chromium.org/1037793002
* SKPDF: refactor pdfcatalog and pdfdocumentGravatar halcanary2015-03-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SkPDFCatalog: - remove first-page-specific code (no longer needed, never used) (e.g. addObject()). - Make use of SkHashMap for lookups (simplifies code). - inline all small methods - emitXrefTable moved to SkPDFDocument.cpp - no longer store offsets in this data structure (moved to SkPDFDocument.cpp) - setFileOffset gone. - own substitute refs directly. SkPDFDocument::EmitPDF() - All sites that call into SkPDFCatalog modified. - catalog.addObject only called in a single place, after the resouceSet is built - offsets moved to local array. SkPDFPage: - finalizePage no longer deals with SkPDFCatalog or resource sets. - GeneratePageTree no longer deals with SkPDFCatalog SkPDFObjRef - emitObject respects the substitution map Unit Tests: - respect SkPDFCatalog::addObject signature change. SkTHash: - #include SkChecksum for SkGoodHash - Copyright notice added Review URL: https://codereview.chromium.org/1033543002
* SkPDF: unit test cleanupGravatar halcanary2015-03-24
| | | | | | BUG=skia:3585 Review URL: https://codereview.chromium.org/1033833002
* PDF: Switch some unit tests to higher level API.Gravatar halcanary2015-03-01
| | | | | | Also, clean up some headers. Review URL: https://codereview.chromium.org/968683002
* PDF : New factory function for SkPDFDeviceGravatar halcanary2015-02-20
| | | | | | SkPDFDevice now has factory function that matches what callers need. Review URL: https://codereview.chromium.org/941023005
* PDF: why do we have flags no one uses (or can use)?Gravatar mtklein2015-02-19
| | | | | | BUG=skia: Review URL: https://codereview.chromium.org/936403002
* PDF: Add (low-memory) SkPDFBitmap classGravatar halcanary2015-02-18
| | | | | | | | | | | | | | | | | | | | | Also: Add SkDeflateWStream and associated unit tests. SkPDFBitmap is a replacement for SkPDFImage. As of now, it only supports 8888 bitmaps (the most common case). SkPDFBitmap takes very little extra memory (aside from refing the bitmap's pixels), and its emitObject() does not cache any data. The SkPDFBitmap::Create function will check the canon for duplicates. This can reduce the size of the output PDF. Motivation: this gives another ~40% decrease in PDF memory overhead TODO: Support other ColorTypes and scrap SkPDFImage. BUG=skia:3030 Review URL: https://codereview.chromium.org/918813002
* zlib/pdf: remove HaveFlate(), depend on preprocessor definesGravatar halcanary2015-02-17
| | | | Review URL: https://codereview.chromium.org/933523007
* Simplify reference management in SkPDFGravatar halcanary2015-02-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prior to this change, SkPDFObject subclasses were required to track their resources separately from the document structure. (An object has a resource if it depends, via an indirect reference, on another object). This led to a lot of extra code to duplicate effort. I replace the getResources() function with the much simpler addResources() function. I only define a non-trivial addResources() method on arrays, dictionaries, and indirect object references. All other specialized classes simply rely on their parent class's implementation. SkPDFObject::addResources() works by recursively walking the directed graph of object (direct and indirect) references and adding resources to a set. It doesn't matter that there are closed loops in the graph, since we check the set before walking down a branch. - Add SkPDFObject::addResources() virtual function, with four implementations - Remove SkPDFObject::getResources() virtual function and all implementations. - Remove SkPDFObject::GetResourcesHelper() - Remove SkPDFObject::AddResourceHelper() - In SkPDFCatalog::findObjectIndex(), add an object to the catalog if it doesn't exist yet. - SkPDFCatalog::setSubstitute() no longer sets up resources - SkPDFDocument.cpp no longer needs the Streamer object - SkPDFDocument.cpp calls fDocCatalog->addResources to build the resource list. - SkPDFFont::addResource() removed - All SkPDF-::fResource sets removed (they are redundant). - removed SkPDFImage::addSMask() function - SkPDFResourceDict::getReferencedResources() removed. Motivation: this removes quite a bit of code and makes the objects slightly slimmer in memory. Most importantly, this will lead the way towards removing SkPDFObject's inheritance from SkRefCnt, which will greatly simplify everything. Testing: I usually test changes to the PDF backend by comparing checksums of PDF files rendered from GMs and SKPs before and after the change. This change both re-orders and re-numbers the indirect PDF objects. I used the qpdf program to normalize the PDFs and then compared the normalized outputs from before and after the change; they matched. Review URL: https://codereview.chromium.org/870333002
* Add missing SK_OVERRIDEGravatar rmistry2015-02-02
| | | | | | | | | | Tested by running on clang head + ubuntu 14.04: GYP_DEFINES=”skia_gpu=0 skia_warnings_as_errors=1" tools/xsan_build thread dm BUILDTYPE=Release out/Release/dm -v BUG=skia:3386 Review URL: https://codereview.chromium.org/894833002
* Cleanup SkPDFObject::emit*Gravatar halcanary2015-01-23
| | | | Review URL: https://codereview.chromium.org/869783003
* Make SkStream *not* ref counted.Gravatar scroggo2015-01-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SkStream is a stateful object, so it does not make sense for it to have multiple owners. Make SkStream inherit directly from SkNoncopyable. Update methods which previously called SkStream::ref() (e.g. SkImageDecoder::buildTileIndex() and SkFrontBufferedStream::Create(), which required the existing owners to call SkStream::unref()) to take ownership of their SkStream parameters and delete when done (including on failure). Switch all SkAutoTUnref<SkStream>s to SkAutoTDelete<SkStream>s. In some cases this means heap allocating streams that were previously stack allocated. Respect ownership rules of SkTypeface::CreateFromStream() and SkImageDecoder::buildTileIndex(). Update the comments for exceptional methods which do not affect the ownership of their SkStream parameters (e.g. SkPicture::CreateFromStream() and SkTypeface::Deserialize()) to be explicit about ownership. Remove test_stream_life, which tested that buildTileIndex() behaved correctly when SkStream was a ref counted object. The test does not make sense now that it is not. In SkPDFStream, remove the SkMemoryStream member. Instead of using it, create a new SkMemoryStream to pass to fDataStream (which is now an SkAutoTDelete). Make other pdf rasterizers behave like SkPDFDocumentToBitmap. SkPDFDocumentToBitmap delete the SkStream, so do the same in the following pdf rasterizers: SkPopplerRasterizePDF SkNativeRasterizePDF SkNoRasterizePDF Requires a change to Android, which currently treats SkStreams as ref counted objects. Review URL: https://codereview.chromium.org/849103004
* In SkPDFDocument::emitPDF(), stop pre-calculating file offsets.Gravatar halcanary2015-01-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add Streamer utility class which measures the current pdf offset by calling SkWStream::bytesWritten(). Calls SkPDFCatalog::setFileOffset() and SkPDFObject::emit() at the same time to guarantee that everything works out. * SkPDFCatalog::setFileOffset() no longer calculates the object's size. * SkPDFCatalog::setSubstituteResourcesOffsets() removed. * SkPDFCatalog::emitSubstituteResources() removed and getSubstituteList() made public in its place. * Remove SkPDFPage::getPageSize and SkPDFPage::emitPage. Replace with SkPDFPage::getContentStream(). * SkPDFObject::getOutputSize no longer virtual, only used in unit tests. All SkPDFObject subclasses getOutputSize() overrides removed. * SkPDFObject::getIndirectOutputSize removed. * PDFPrimitivesTest updated for new functions. Review URL: https://codereview.chromium.org/846023003
* Change function signature of SkPDFObject::emitObject.Gravatar halcanary2015-01-12
| | | | | | | | | | | | | Replace virutal SkPDFObject::emitObject(s, c, true) with non-virtual SkPDFObject::emitIndirectObject(s, c), since none of the subclasses do (or should do) anything different. Replace object->emitObject(s, c, false) with object->emitObject(s, c) This is one step in simplifying the SkPDFObject interface to allow for the next step in refactoring. Review URL: https://codereview.chromium.org/827733004
* Fix up all the easy virtual ... SK_OVERRIDE cases.Gravatar mtklein2015-01-09
| | | | | | | | | | | | This fixes every case where virtual and SK_OVERRIDE were on the same line, which should be the bulk of cases. We'll have to manually clean up the rest over time unless I level up in regexes. for f in (find . -type f); perl -p -i -e 's/virtual (.*)SK_OVERRIDE/\1SK_OVERRIDE/g' $f; end BUG=skia: Review URL: https://codereview.chromium.org/806653007
* Add toString methods to SkImageFilter-derived classesGravatar robertphillips2014-12-19
| | | | | | This isn't definitive but at least makes something show up in the debugger. Review URL: https://codereview.chromium.org/789163006
* DM warning-free on win64Gravatar bsalomon2014-12-12
| | | | Review URL: https://codereview.chromium.org/805543002
* Remove SK_SUPPORT_LEGACY_DEEPFLATTENING.Gravatar mtklein2014-12-01
| | | | | | | | | | | | This was needed for pictures before v33, and we're now requiring v35+. Will follow up with the same for skia/ext/pixel_ref_utils_unittest.cc BUG=skia: Committed: https://skia.googlesource.com/skia/+/52c293547b973f7fb5de3c83f5062b07d759ab88 Review URL: https://codereview.chromium.org/769953002
* Revert of Remove SK_SUPPORT_LEGACY_DEEPFLATTENING. (patchset #1 id:1 of ↵Gravatar mtklein2014-12-01
| | | | | | | | | | | | | | | | | | | | | | | | | https://codereview.chromium.org/769953002/) Reason for revert: Breaks canary builds. Will reland after the Chromium change lands. Original issue's description: > Remove SK_SUPPORT_LEGACY_DEEPFLATTENING. > > This was needed for pictures before v33, and we're now requiring v35+. > > Will follow up with the same for skia/ext/pixel_ref_utils_unittest.cc > > BUG=skia: > > Committed: https://skia.googlesource.com/skia/+/52c293547b973f7fb5de3c83f5062b07d759ab88 TBR=reed@google.com,mtklein@chromium.org NOTREECHECKS=true NOTRY=true BUG=skia: Review URL: https://codereview.chromium.org/768183002
* Remove SK_SUPPORT_LEGACY_DEEPFLATTENING.Gravatar mtklein2014-12-01
| | | | | | | | | | This was needed for pictures before v33, and we're now requiring v35+. Will follow up with the same for skia/ext/pixel_ref_utils_unittest.cc BUG=skia: Review URL: https://codereview.chromium.org/769953002
* Fix image filters for PDF backend.Gravatar senorblanco2014-10-20
| | | | | | | | | | | | | | | | Currently, the PDF backend does not support image filters (since PDF does not have that functionality), so it simply removes them. This is causing Chrome print preview to render incorrectly (see bug). The fix here is to fall back to a raster device for image filters, as we used to do in Blink. The resulting bitmap will be drawn to the destination device as a normal main-memory-backed bitmap. Note: this change invalidates the PDF results of all GMs containing image filters (since they'll actually be rendered). BUG=422144 Review URL: https://codereview.chromium.org/644323006
* replace setConfig+allocPixels with single callGravatar mike@reedtribe.org2014-02-13
| | | | | | | | BUG=skia: Review URL: https://codereview.chromium.org/162643002 git-svn-id: http://skia.googlecode.com/svn/trunk@13426 2bbb7eff-a529-9590-31e7-b0007b416f81
* Cleanup: Sanitize the order of includes under tests/Gravatar tfarina@chromium.org2014-01-24
| | | | | | | | | | | | | | | | Initially this was to make sure Test.h appeared after the Sk*.h includes. Patch generated by the following command line: $ ~/chromium/src/tools/sort-headers.py tests/*.cpp BUG=None TEST=tests R=robertphillips@google.com Review URL: https://codereview.chromium.org/145313004 git-svn-id: http://skia.googlecode.com/svn/trunk@13177 2bbb7eff-a529-9590-31e7-b0007b416f81
* Move macros from TestClassDef.h to Test.hGravatar commit-bot@chromium.org2014-01-14
| | | | | | | | | | | | | | Motivation: those macros don't make any sense without the definitions in Test.h. BUG= R=mtklein@google.com Author: halcanary@google.com Review URL: https://codereview.chromium.org/138563004 git-svn-id: http://skia.googlecode.com/svn/trunk@13074 2bbb7eff-a529-9590-31e7-b0007b416f81
* remove SK_SCALAR_IS_[FLOAT,FIXED] and assume floatsGravatar reed@google.com2013-12-17
| | | | | | | | | | | | | To keep the CL (slightly) managable, this does not make any changes to existing macros (e.g. SkScalarMul). Just tackling #ifdef constructs this time around. BUG= R=bsalomon@google.com, caryclark@google.com Review URL: https://codereview.chromium.org/117053002 git-svn-id: http://skia.googlecode.com/svn/trunk@12712 2bbb7eff-a529-9590-31e7-b0007b416f81
* Use DEFINE_TESTCLASS_SHORT macro in tests.Gravatar tfarina@chromium.org2013-12-12
| | | | | | | | | | | | | The three version of DEFINE_TESTCLASS macro is deprecated and thus just use the simple, short one. BUG=None TEST=out/Debug/tests R=mtklein@google.com, bsalomon@google.com, robertphillips@google.com Review URL: https://codereview.chromium.org/100113004 git-svn-id: http://skia.googlecode.com/svn/trunk@12653 2bbb7eff-a529-9590-31e7-b0007b416f81
* Use SkPicture::ExtractBitmap callback in pdf too, there is no need for a ↵Gravatar commit-bot@chromium.org2013-10-03
| | | | | | | | | | | | specialized function pointer for pdf only only to pass a rectangle, when we can use subseted bitmaps. R=scroggo@google.com, reed@google.com, vandebo@chromium.org, bsalomon@google.com Author: edisonn@google.com Review URL: https://codereview.chromium.org/25054002 git-svn-id: http://skia.googlecode.com/svn/trunk@11591 2bbb7eff-a529-9590-31e7-b0007b416f81
* Fix leaked SkPDFDevice in PDFPrimitivesTest.cppGravatar robertphillips@google.com2013-08-26
| | | | | | | | https://chromiumcodereview.appspot.com/23003035/ git-svn-id: http://skia.googlecode.com/svn/trunk@10910 2bbb7eff-a529-9590-31e7-b0007b416f81
* Sanitizing source files in Skia_Periodic_House_KeepingGravatar skia.committer@gmail.com2013-04-25
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@8851 2bbb7eff-a529-9590-31e7-b0007b416f81
* Fix compile warning on mac that breaks a bot, and remove jpeg creation ↵Gravatar edisonn@google.com2013-04-24
| | | | | | bitmap since we mock the compression. git-svn-id: http://skia.googlecode.com/svn/trunk@8836 2bbb7eff-a529-9590-31e7-b0007b416f81
* Encode images with DCTDecode (JPEG) in PDFs if it makes sense. Fallback to ↵Gravatar edisonn@google.com2013-04-24
| | | | | | | | | FlateDecode (zip) if it makes sense. Otherewise include uncompressed stream. This change will reduce the size of PDFs to 50% (in the case of the existing SKPs, we reduce the total size of PDFs from 105MB to 50MB) Review URL: https://codereview.appspot.com/7068055 git-svn-id: http://skia.googlecode.com/svn/trunk@8835 2bbb7eff-a529-9590-31e7-b0007b416f81
* resubmit https://code.google.com/p/skia/source/detail?r=7883 (in the meantime weGravatar edisonn@google.com2013-04-02
| | | | | | | added capability to collect minidump and callstack if buildbot fails with heap coruption in windows, and a NPE bug was fixed in SkPDFDocument, when document was destroyed without ever beeing used and a field was NULL + a few minor conflicts have been resolved) git-svn-id: http://skia.googlecode.com/svn/trunk@8487 2bbb7eff-a529-9590-31e7-b0007b416f81
* Fix minor valgrind-found memory leaksGravatar robertphillips@google.com2013-03-21
| | | | | | | | https://codereview.chromium.org/12440066/ git-svn-id: http://skia.googlecode.com/svn/trunk@8297 2bbb7eff-a529-9590-31e7-b0007b416f81
* Reverting r8233 (Use SkSet in PDF)Gravatar robertphillips@google.com2013-03-20
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@8255 2bbb7eff-a529-9590-31e7-b0007b416f81
* resubmit https://code.google.com/p/skia/source/detail?r=7883 (in the ↵Gravatar edisonn@google.com2013-03-19
| | | | | | | | meantime we added capability to collect minidump and callstack if buildbot fails with heap coruption in windows. a few minor conflicts have been resolved) Review URL: https://codereview.chromium.org/12840004 git-svn-id: http://skia.googlecode.com/svn/trunk@8233 2bbb7eff-a529-9590-31e7-b0007b416f81
* Update flag to reflect actual meaning.Gravatar edisonn@google.com2013-03-12
| | | | | | Review URL: https://codereview.chromium.org/12754004 git-svn-id: http://skia.googlecode.com/svn/trunk@8118 2bbb7eff-a529-9590-31e7-b0007b416f81
* revert r7892Gravatar edisonn@google.com2013-02-28
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@7896 2bbb7eff-a529-9590-31e7-b0007b416f81
* resubmit after fixing assert issue: https://codereview.appspot.com/6744050Gravatar edisonn@google.com2013-02-27
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@7892 2bbb7eff-a529-9590-31e7-b0007b416f81
* Tests : Unused parameters cleanupGravatar sugoi@google.com2013-02-27
| | | | | | | I removed unused parameters in the tests wherever it was trivial to do so. I'm trying to get the easy ones out of the way before we get into more involved discussions around this. Review URL: https://codereview.appspot.com/7394055 git-svn-id: http://skia.googlecode.com/svn/trunk@7891 2bbb7eff-a529-9590-31e7-b0007b416f81
* Revert r7883Gravatar edisonn@google.com2013-02-27
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@7884 2bbb7eff-a529-9590-31e7-b0007b416f81
* Use SkSet to fix issue when pdf generates an exp number of resources.Gravatar edisonn@google.com2013-02-27
| | | | | | | | | | | | | | | The problem fixed - http://code.google.com/p/skia/issues/detail?id=940 - is that getResources will recursively obtain all child resource recursively without checking for duplicates. If we have lots of duplicates, then we try to build a very large vector (exponential with the number of nodes usually) and sooner or later we end up using too much memory and crash. A possible solution could have been to make sure resources do not have duplicates, but that requirement is impractical, and it this leaves the solution fragile, if there is any issue in the tree, we crash. When we emit the pdf, the large number of duplicates is not an issue, because SkPDFCatalog::addObject will deal with duplicates. I have run the gm with --config pdf, and the images are 100% same bits, while the pdfs have the same size but some very small changes, the order of some objects. Review URL: https://codereview.appspot.com/6744050 git-svn-id: http://skia.googlecode.com/svn/trunk@7883 2bbb7eff-a529-9590-31e7-b0007b416f81
* [PDF] Handle invalid glyph IDs on drawText methods.Gravatar vandebo@chromium.org2013-01-25
| | | | | | Review URL: https://codereview.appspot.com/7179053 git-svn-id: http://skia.googlecode.com/svn/trunk@7401 2bbb7eff-a529-9590-31e7-b0007b416f81