aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pdf/SkPDFTypes.h
diff options
context:
space:
mode:
authorGravatar halcanary <halcanary@google.com>2015-01-13 07:12:57 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-01-13 07:12:57 -0800
commitf361b714390422a5c2a8b1dacb8e67502d0e40bb (patch)
treed93e75f01c0f47ce6ec49bc8065070686b251d20 /src/pdf/SkPDFTypes.h
parent7e783786d8bc0abeac0f5a17a8169675a6b7a2b0 (diff)
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
Diffstat (limited to 'src/pdf/SkPDFTypes.h')
-rw-r--r--src/pdf/SkPDFTypes.h11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/pdf/SkPDFTypes.h b/src/pdf/SkPDFTypes.h
index 75989c09ed..ce1ca86e6e 100644
--- a/src/pdf/SkPDFTypes.h
+++ b/src/pdf/SkPDFTypes.h
@@ -31,12 +31,11 @@ public:
SK_DECLARE_INST_COUNT(SkPDFObject)
/** Return the size (number of bytes) of this object in the final output
- * file. Compound objects or objects that are computationally intensive
- * to output should override this method.
+ * file. Only used for testing.
* @param catalog The object catalog to use.
* @param indirect If true, output an object identifier with the object.
*/
- virtual size_t getOutputSize(SkPDFCatalog* catalog, bool indirect);
+ size_t getOutputSize(SkPDFCatalog* catalog, bool indirect);
/** For non-primitive objects (i.e. objects defined outside this file),
* this method will add to newResourceObjects any objects that this method
@@ -116,7 +115,6 @@ public:
// The SkPDFObject interface.
virtual void emitObject(SkWStream* stream, SkPDFCatalog* catalog) SK_OVERRIDE;
- virtual size_t getOutputSize(SkPDFCatalog* catalog, bool indirect);
private:
SkAutoTUnref<SkPDFObject> fObj;
@@ -163,7 +161,6 @@ public:
// The SkPDFObject interface.
virtual void emitObject(SkWStream* stream, SkPDFCatalog* catalog) SK_OVERRIDE;
- virtual size_t getOutputSize(SkPDFCatalog* catalog, bool indirect);
private:
bool fValue;
@@ -221,7 +218,6 @@ public:
// The SkPDFObject interface.
virtual void emitObject(SkWStream* stream, SkPDFCatalog* catalog) SK_OVERRIDE;
- virtual size_t getOutputSize(SkPDFCatalog* catalog, bool indirect);
static SkString FormatString(const char* input, size_t len);
static SkString FormatString(const uint16_t* input, size_t len,
@@ -256,7 +252,6 @@ public:
// The SkPDFObject interface.
virtual void emitObject(SkWStream* stream, SkPDFCatalog* catalog) SK_OVERRIDE;
- virtual size_t getOutputSize(SkPDFCatalog* catalog, bool indirect);
private:
static const size_t kMaxLen = 127;
@@ -283,7 +278,6 @@ public:
// The SkPDFObject interface.
virtual void emitObject(SkWStream* stream, SkPDFCatalog* catalog) SK_OVERRIDE;
- virtual size_t getOutputSize(SkPDFCatalog* catalog, bool indirect);
/** The size of the array.
*/
@@ -355,7 +349,6 @@ public:
// The SkPDFObject interface.
virtual void emitObject(SkWStream* stream, SkPDFCatalog* catalog) SK_OVERRIDE;
- virtual size_t getOutputSize(SkPDFCatalog* catalog, bool indirect);
/** The size of the dictionary.
*/