aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pdf/SkPDFTypes.cpp
diff options
context:
space:
mode:
authorGravatar halcanary <halcanary@google.com>2015-01-12 10:07:50 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-01-12 10:07:50 -0800
commit4fc48af0d7bec93a911d32330f251386a8adec98 (patch)
tree5f7335bed00f121fade421297dd117c8bebc2037 /src/pdf/SkPDFTypes.cpp
parent0899696e9fec7d376b63655bedaed76871cb15c2 (diff)
Change function signature of SkPDFObject::emitObject.
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
Diffstat (limited to 'src/pdf/SkPDFTypes.cpp')
-rw-r--r--src/pdf/SkPDFTypes.cpp52
1 files changed, 14 insertions, 38 deletions
diff --git a/src/pdf/SkPDFTypes.cpp b/src/pdf/SkPDFTypes.cpp
index 7b79e411b6..7562528c04 100644
--- a/src/pdf/SkPDFTypes.cpp
+++ b/src/pdf/SkPDFTypes.cpp
@@ -22,7 +22,11 @@
void SkPDFObject::emit(SkWStream* stream, SkPDFCatalog* catalog,
bool indirect) {
SkPDFObject* realObject = catalog->getSubstituteObject(this);
- return realObject->emitObject(stream, catalog, indirect);
+ if (indirect) {
+ realObject->emitIndirectObject(stream, catalog);
+ } else {
+ realObject->emitObject(stream, catalog);
+ }
}
size_t SkPDFObject::getOutputSize(SkPDFCatalog* catalog, bool indirect) {
@@ -77,9 +81,7 @@ SkPDFObjRef::SkPDFObjRef(SkPDFObject* obj) : fObj(obj) {
SkPDFObjRef::~SkPDFObjRef() {}
-void SkPDFObjRef::emitObject(SkWStream* stream, SkPDFCatalog* catalog,
- bool indirect) {
- SkASSERT(!indirect);
+void SkPDFObjRef::emitObject(SkWStream* stream, SkPDFCatalog* catalog) {
catalog->emitObjectNumber(stream, fObj.get());
stream->writeText(" R");
}
@@ -92,20 +94,14 @@ size_t SkPDFObjRef::getOutputSize(SkPDFCatalog* catalog, bool indirect) {
SkPDFInt::SkPDFInt(int32_t value) : fValue(value) {}
SkPDFInt::~SkPDFInt() {}
-void SkPDFInt::emitObject(SkWStream* stream, SkPDFCatalog* catalog,
- bool indirect) {
- if (indirect) {
- return emitIndirectObject(stream, catalog);
- }
+void SkPDFInt::emitObject(SkWStream* stream, SkPDFCatalog* catalog) {
stream->writeDecAsText(fValue);
}
SkPDFBool::SkPDFBool(bool value) : fValue(value) {}
SkPDFBool::~SkPDFBool() {}
-void SkPDFBool::emitObject(SkWStream* stream, SkPDFCatalog* catalog,
- bool indirect) {
- SkASSERT(!indirect);
+void SkPDFBool::emitObject(SkWStream* stream, SkPDFCatalog* catalog) {
if (fValue) {
stream->writeText("true");
} else {
@@ -124,12 +120,7 @@ size_t SkPDFBool::getOutputSize(SkPDFCatalog* catalog, bool indirect) {
SkPDFScalar::SkPDFScalar(SkScalar value) : fValue(value) {}
SkPDFScalar::~SkPDFScalar() {}
-void SkPDFScalar::emitObject(SkWStream* stream, SkPDFCatalog* catalog,
- bool indirect) {
- if (indirect) {
- return emitIndirectObject(stream, catalog);
- }
-
+void SkPDFScalar::emitObject(SkWStream* stream, SkPDFCatalog* catalog) {
Append(fValue, stream);
}
@@ -196,10 +187,7 @@ SkPDFString::SkPDFString(const uint16_t* value, size_t len, bool wideChars)
SkPDFString::~SkPDFString() {}
-void SkPDFString::emitObject(SkWStream* stream, SkPDFCatalog* catalog,
- bool indirect) {
- if (indirect)
- return emitIndirectObject(stream, catalog);
+void SkPDFString::emitObject(SkWStream* stream, SkPDFCatalog* catalog) {
stream->write(fValue.c_str(), fValue.size());
}
@@ -282,9 +270,7 @@ bool SkPDFName::operator==(const SkPDFName& b) const {
return fValue == b.fValue;
}
-void SkPDFName::emitObject(SkWStream* stream, SkPDFCatalog* catalog,
- bool indirect) {
- SkASSERT(!indirect);
+void SkPDFName::emitObject(SkWStream* stream, SkPDFCatalog* catalog) {
stream->write(fValue.c_str(), fValue.size());
}
@@ -318,12 +304,7 @@ SkPDFArray::~SkPDFArray() {
fValue.unrefAll();
}
-void SkPDFArray::emitObject(SkWStream* stream, SkPDFCatalog* catalog,
- bool indirect) {
- if (indirect) {
- return emitIndirectObject(stream, catalog);
- }
-
+void SkPDFArray::emitObject(SkWStream* stream, SkPDFCatalog* catalog) {
stream->writeText("[");
for (int i = 0; i < fValue.count(); i++) {
fValue[i]->emit(stream, catalog, false);
@@ -402,12 +383,7 @@ int SkPDFDict::size() const {
}
-void SkPDFDict::emitObject(SkWStream* stream, SkPDFCatalog* catalog,
- bool indirect) {
- if (indirect) {
- return emitIndirectObject(stream, catalog);
- }
-
+void SkPDFDict::emitObject(SkWStream* stream, SkPDFCatalog* catalog) {
SkAutoMutexAcquire lock(fMutex); // If another thread triggers a
// resize while this thread is in
// the for-loop, we can be left
@@ -416,7 +392,7 @@ void SkPDFDict::emitObject(SkWStream* stream, SkPDFCatalog* catalog,
for (int i = 0; i < fValue.count(); i++) {
SkASSERT(fValue[i].key);
SkASSERT(fValue[i].value);
- fValue[i].key->emitObject(stream, catalog, false);
+ fValue[i].key->emitObject(stream, catalog);
stream->writeText(" ");
fValue[i].value->emit(stream, catalog, false);
stream->writeText("\n");