aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pdf/SkPDFResourceDict.cpp
Commit message (Collapse)AuthorAge
* SkPDF: refactor & code cleanup ahead of https://crrev.com/2322403002Gravatar halcanary2016-09-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | SkPDFDevice::GraphicStateEntry: remove unnecessary fFont and fTextSize. SkPDFDevice::updateFont(): replace with update_font() and inlined code. De-duplicate this block of code. SkPDFResourceDict::GetResourceTypePrefix function made public: removes need for temporary SkString returned by SkPDFResourceDict::getResourceName() GlyphPositioner: delay writing intial matrix until first glyph. Assert that widechars is a constant. SkPDFFont::FontType(): make public so that PDFDevice can know about multibyte status. SkPDFFont::countStretch() removed, and the stretch loop flattened. *no changes in PDF output* BUG=skia:5434 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2327953002 Review-Url: https://codereview.chromium.org/2327953002
* Remove unnecessary includes in src/pdf/Gravatar martina.kollarova2016-06-29
| | | | | | | | | Use forward declaration more. BUG=None GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2110033002 Review-Url: https://codereview.chromium.org/2110033002
* SkPDF: use sk_ref_spGravatar halcanary2016-03-09
| | | | | | | | s/sk_sp<[^>]*>(SkRef(\([^)]*\)))/sk_ref_sp(\1)/ GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1777923002 Review URL: https://codereview.chromium.org/1777923002
* SkPDF: Add sk_sp setters; .release() becomes std::move()Gravatar halcanary2016-03-08
| | | | | | | | | | | | | | | | Note to reviewers: Start with changes to SkPDFTypes.h Many places that had a bare pointer owning a reference are refactored to use a sk_sp. There remain several places where a non-owning pointer `T*` should be replaced with `const sk_sp<T>&` to eliminate the common pattern `sk_sp<T>(SkRef(x))`. Committed: https://skia.googlesource.com/skia/+/9904c9212074279380e21f96575078734dbbd308 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1775043002 Review URL: https://codereview.chromium.org/1775043002
* Revert of SkPDF: Add sk_sp setters; .release() becomes std::move() (patchset ↵Gravatar halcanary2016-03-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | #2 id:20001 of https://codereview.chromium.org/1775043002/ ) Reason for revert: https://build.chromium.org/p/client.skia/builders/Linux%20Builder/builds/6405/steps/compile/logs/stdio Original issue's description: > SkPDF: Add sk_sp setters; .release() becomes std::move() > > Note to reviewers: Start with changes to SkPDFTypes.h > > Many places that had a bare pointer owning a reference are refactored to > use a sk_sp. > > There remain several places where a non-owning pointer `T*` should be > replaced with `const sk_sp<T>&` to eliminate the common pattern > `sk_sp<T>(SkRef(x))`. > > Committed: https://skia.googlesource.com/skia/+/9904c9212074279380e21f96575078734dbbd308 TBR=bungeman@google.com # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Review URL: https://codereview.chromium.org/1775143002
* SkPDF: Add sk_sp setters; .release() becomes std::move()Gravatar halcanary2016-03-08
| | | | | | | | | | | | | Note to reviewers: Start with changes to SkPDFTypes.h Many places that had a bare pointer owning a reference are refactored to use a sk_sp. There remain several places where a non-owning pointer `T*` should be replaced with `const sk_sp<T>&` to eliminate the common pattern `sk_sp<T>(SkRef(x))`. Review URL: https://codereview.chromium.org/1775043002
* SkPDF: use sk_make_sp<T> when it makes sense.Gravatar halcanary2016-03-08
| | | | | | GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1773033002 Review URL: https://codereview.chromium.org/1773033002
* SkPDF: s/SkAutoTUnref/sk_sp/gGravatar halcanary2016-03-07
| | | | Review URL: https://codereview.chromium.org/1771073002
* SkPDF: AutoTUnref<T> changes in useGravatar halcanary2016-03-06
| | | | | | | | | | ::detach() -> ::release() ::operator T*() -> ::get() This makes all use of AutoTUnref work the same as sk_sp. GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1772493002 Review URL: https://codereview.chromium.org/1772493002
* Style Change: SkNEW->new; SkDELETE->deleteGravatar halcanary2015-08-26
| | | | | | DOCS_PREVIEW= https://skia.org/?cl=1316123003 Review URL: https://codereview.chromium.org/1316123003
* Use static_assert instead of SK_COMPILE_ASSERT.Gravatar bungeman2015-08-20
| | | | | | | Now that static_assert is allowed, there is no need to use a non- standard compile time assertion Review URL: https://codereview.chromium.org/1306443004
* 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: ResourceDict replaced by factory functionGravatar halcanary2015-04-09
| | | | | | | | | Motivation: Having a class here was unnecessary, since the only thing that set this class apart was how it is created, not how it behaves. BUG=skia:3585 Review URL: https://codereview.chromium.org/1068343003
* SkPDF: clean up extra referencesGravatar halcanary2015-03-24
| | | | | | This cleans up code left behind from http://crrev.com/870333002 Review URL: https://codereview.chromium.org/1029263004
* 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
* Fix compilation with SK_ENABLE_INST_COUNT=1Gravatar commit-bot@chromium.org2013-12-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add INHERITED declarations to class declarations that prevent compilation with the flag. Remove SK_DEFINE_INST_COUNT from all class implementations. Instead, use function-local static variables in the reference count helper classes to create the global instances to store the needed info. The accessor functions are defined inline in the helper classes, so definitions are not needed. The initialization point of the variables should be as well defined as previously. Remove SK_DECLARE_INST_COUNT_TEMPLATE and use SK_DECLARE_INST_COUNT instead. This avoids possible future compilation errors further. For SK_ENABLE_INST_COUNT=0 compilation, add an empty static member function to all classes that use SK_DECLARE_INST_COUNT and SK_DECLARE_INST_COUNT_ROOT macros. The function ensures that classes contain public INHERITED typedef. This member function seems to be compiled away. This shouĺd ensure that part of the compilation errors are caught earlier. Also adds DSK_DECLARE_INST_COUNT to few SkPDFDict subclasses. R=robertphillips@google.com, richardlin@chromium.org, bsalomon@google.com Author: kkinnunen@nvidia.com Review URL: https://codereview.chromium.org/98703002 git-svn-id: http://skia.googlecode.com/svn/trunk@12501 2bbb7eff-a529-9590-31e7-b0007b416f81
* Second wave of Win64 warning cleanupGravatar robertphillips@google.com2013-10-15
| | | | | | | | https://codereview.chromium.org/27343002/ git-svn-id: http://skia.googlecode.com/svn/trunk@11778 2bbb7eff-a529-9590-31e7-b0007b416f81
* Fix memory leak in SkPDFResourceDictGravatar commit-bot@chromium.org2013-08-01
| | | | | | | | | | R=vandebo@chromium.org, edisonn@google.com Author: richardlin@chromium.org Review URL: https://chromiumcodereview.appspot.com/20655004 git-svn-id: http://skia.googlecode.com/svn/trunk@10499 2bbb7eff-a529-9590-31e7-b0007b416f81
* Fix Clang build on SkPDFResourceDict (CL 18977002)Gravatar commit-bot@chromium.org2013-07-23
| | | | | | | | | | R=edisonn@google.com, vandebo@chromium.org Author: richardlin@chromium.org Review URL: https://chromiumcodereview.appspot.com/19954011 git-svn-id: http://skia.googlecode.com/svn/trunk@10295 2bbb7eff-a529-9590-31e7-b0007b416f81
* Revert "Adds SkPDFResourceDict class, refactor existing code to use it."Gravatar vandebo@chromium.org2013-07-22
| | | | | | | | This reverts commit r10245 Review URL: https://codereview.chromium.org/19523007 git-svn-id: http://skia.googlecode.com/svn/trunk@10247 2bbb7eff-a529-9590-31e7-b0007b416f81
* Adds SkPDFResourceDict class, refactor existing code to use it.Gravatar commit-bot@chromium.org2013-07-22
| | | | | | | | | | | | Committed: http://code.google.com/p/skia/source/detail?r=10202 R=vandebo@chromium.org, edisonn@google.com Author: richardlin@chromium.org Review URL: https://chromiumcodereview.appspot.com/18977002 git-svn-id: http://skia.googlecode.com/svn/trunk@10245 2bbb7eff-a529-9590-31e7-b0007b416f81
* Revert "Adds SkPDFResourceDict class to manage resource dicts. Refactors ↵Gravatar vandebo@chromium.org2013-07-19
| | | | | | | | | | existing code to use this class." This reverts commit r10202 Review URL: https://codereview.chromium.org/19790007 git-svn-id: http://skia.googlecode.com/svn/trunk@10205 2bbb7eff-a529-9590-31e7-b0007b416f81
* Adds SkPDFResourceDict class to manage resource dicts. Refactors existing ↵Gravatar commit-bot@chromium.org2013-07-19
code to use this class. BUG= R=vandebo@chromium.org, edisonn@google.com Author: richardlin@chromium.org Review URL: https://chromiumcodereview.appspot.com/18977002 git-svn-id: http://skia.googlecode.com/svn/trunk@10202 2bbb7eff-a529-9590-31e7-b0007b416f81