In SkPDFDocument::emitPDF(), stop pre-calculating file offsets.
authorhalcanary <halcanary@google.com>
Tue, 13 Jan 2015 15:12:57 +0000 (07:12 -0800)
committerCommit bot <commit-bot@chromium.org>
Tue, 13 Jan 2015 15:12:57 +0000 (07:12 -0800)
commitf361b714390422a5c2a8b1dacb8e67502d0e40bb
treed93e75f01c0f47ce6ec49bc8065070686b251d20
parent7e783786d8bc0abeac0f5a17a8169675a6b7a2b0
In SkPDFDocument::emitPDF(), stop pre-calculating file offsets.

* 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
12 files changed:
src/pdf/SkPDFCatalog.cpp
src/pdf/SkPDFCatalog.h
src/pdf/SkPDFDocument.cpp
src/pdf/SkPDFGraphicState.cpp
src/pdf/SkPDFGraphicState.h
src/pdf/SkPDFPage.cpp
src/pdf/SkPDFPage.h
src/pdf/SkPDFStream.cpp
src/pdf/SkPDFStream.h
src/pdf/SkPDFTypes.cpp
src/pdf/SkPDFTypes.h
tests/PDFPrimitivesTest.cpp