Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(949)

Unified Diff: src/pdf/SkPDFTypes.cpp

Issue 827733004: Change function signature of SkPDFObject::emitObject. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/pdf/SkPDFTypes.h ('k') | tests/PDFPrimitivesTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pdf/SkPDFTypes.cpp
diff --git a/src/pdf/SkPDFTypes.cpp b/src/pdf/SkPDFTypes.cpp
index 7b79e411b601f7845ab49390f734eaf322ea4f70..7562528c041dc2cc4e250f4215bdc7f557cda11d 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");
« no previous file with comments | « src/pdf/SkPDFTypes.h ('k') | tests/PDFPrimitivesTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698