Go to file
halcanary bf799cd228 Simplify reference management in SkPDF
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
2015-02-10 13:32:09 -08:00
animations first cut at a checkbox 2009-10-21 19:41:10 +00:00
bench Revert of nanobench: lazily decode bitmaps in .skps. (patchset #1 id:1 of https://codereview.chromium.org/743613005/) 2015-02-09 11:58:41 -08:00
bin Add a script to fetch the latest SKPs. 2015-01-28 09:39:10 -08:00
debugger Make SkStream *not* ref counted. 2015-01-21 12:09:53 -08:00
dm Add SkSVGCanvas 2015-02-06 12:51:10 -08:00
docs Fix references to https://sites.google.com/site/skiadocs/. 2015-02-03 13:12:54 -02:00
example move HelloWorld to be a peer of SampleApp 2015-02-02 12:55:14 -08:00
experimental Add SkSVGCanvas 2015-02-06 12:51:10 -08:00
forth Sanitizing source files in Skia_Periodic_House_Keeping 2013-01-26 07:06:02 +00:00
gm Clean up clipping code a bit 2015-02-10 08:16:55 -08:00
gyp GYP groudwork for half-float opts support. 2015-02-10 09:17:05 -08:00
include check for nonfinites in rrects 2015-02-10 08:46:22 -08:00
platform_tools Additional cleanups to Android config parsing. 2015-02-10 07:51:12 -08:00
resources Fix references to https://sites.google.com/site/skiadocs/. 2015-02-03 13:12:54 -02:00
samplecode more gms for conics 2015-02-09 13:01:05 -08:00
site Update docs with instructions for debugging Android SampleApp. 2015-02-10 13:17:07 -08:00
src Simplify reference management in SkPDF 2015-02-10 13:32:09 -08:00
tests Simplify reference management in SkPDF 2015-02-10 13:32:09 -08:00
third_party DM warning-free on win64 2014-12-12 16:41:46 -08:00
tools rewrite ambiguous comment 2015-02-10 07:47:31 -08:00
.gitignore Cleanup: Remove bug_chomper entry from .gitignore. 2014-11-24 17:53:55 -08:00
AUTHORS Fix GIF transparency. 2015-02-04 21:31:23 -08:00
codereview.settings Add Project to skia 2014-06-20 09:39:15 -07:00
CONTRIBUTING Fix references to https://sites.google.com/site/skiadocs/. 2015-02-03 13:12:54 -02:00
CQ_COMMITTERS add new Skia team member to committers list 2015-02-03 11:10:57 -08:00
DEPS GYP groudwork for half-float opts support. 2015-02-10 09:17:05 -08:00
Doxyfile Fix links to skia-buildbot code in preparation for deletion 2014-10-14 04:44:44 -07:00
gyp_skia allow caller to override the default output directory for gyp 2014-09-29 11:42:25 -07:00
gyp_skia.py Roll gyp deps from 1765 to 1796. 2013-11-21 18:11:14 +00:00
LICENSE Manually update copyright notices in files that defied the automated process 2011-07-28 14:24:55 +00:00
make.bat Fix references to https://sites.google.com/site/skiadocs/. 2015-02-03 13:12:54 -02:00
make.py Fix references to https://sites.google.com/site/skiadocs/. 2015-02-03 13:12:54 -02:00
Makefile Fix references to https://sites.google.com/site/skiadocs/. 2015-02-03 13:12:54 -02:00
OWNERS add root files from chrome 2013-08-13 19:11:15 +00:00
PRESUBMIT.py PRESUBMIT should only check owners for the top level include directory 2014-08-26 14:00:55 -07:00
README Fix references to https://sites.google.com/site/skiadocs/. 2015-02-03 13:12:54 -02:00
README.chromium add root files from chrome 2013-08-13 19:11:15 +00:00
skia.gyp Fix references to https://sites.google.com/site/skiadocs/. 2015-02-03 13:12:54 -02:00
SKP_VERSION Update SKP version 2015-02-09 23:04:25 -08:00
whitespace.txt whitespace 2015-02-05 13:55:34 -08:00

Skia is a complete 2D graphic library for drawing Text, Geometries, and Images.

See full details, and build instructions, at https://skia.org.