Address senorblanco's comments on r600.
Don't inline constructors and destructors.
Include license in test file.
A few nits
Also, cleanup a couple compile warnings.
Review URL: http://codereview.appspot.com/2279043
git-svn-id: http://skia.googlecode.com/svn/trunk@601 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/pdf/SkPDFTypes.cpp b/src/pdf/SkPDFTypes.cpp
index 83f133e..f5f23ca 100644
--- a/src/pdf/SkPDFTypes.cpp
+++ b/src/pdf/SkPDFTypes.cpp
@@ -18,6 +18,9 @@
#include "SkPDFTypes.h"
#include "SkStream.h"
+SkPDFObject::SkPDFObject() {}
+SkPDFObject::~SkPDFObject() {}
+
size_t SkPDFObject::getOutputSize(SkPDFCatalog* catalog, bool indirect) {
SkDynamicMemoryWStream buffer;
emitObject(&buffer, catalog, indirect);
@@ -31,6 +34,9 @@
stream->writeText("\nendobj\n");
}
+SkPDFObjRef::SkPDFObjRef(SkPDFObject* obj) : fObj(obj) {}
+SkPDFObjRef::~SkPDFObjRef() {}
+
size_t SkPDFObject::getIndirectOutputSize(SkPDFCatalog* catalog) {
return catalog->getObjectNumberSize(this) + strlen(" obj\n") +
this->getOutputSize(catalog, false) + strlen("\nendobj\n");
@@ -48,6 +54,9 @@
return catalog->getObjectNumberSize(fObj.get()) + strlen(" R");
}
+SkPDFInt::SkPDFInt(int32_t value) : fValue(value) {}
+SkPDFInt::~SkPDFInt() {}
+
void SkPDFInt::emitObject(SkWStream* stream, SkPDFCatalog* catalog,
bool indirect) {
if (indirect)
@@ -55,6 +64,9 @@
stream->writeDecAsText(fValue);
}
+SkPDFScalar::SkPDFScalar(SkScalar value) : fValue(value) {}
+SkPDFScalar::~SkPDFScalar() {}
+
void SkPDFScalar::emitObject(SkWStream* stream, SkPDFCatalog* catalog,
bool indirect) {
if (indirect)
@@ -70,6 +82,8 @@
: fValue(formatString(value)) {
}
+SkPDFString::~SkPDFString() {}
+
void SkPDFString::emitObject(SkWStream* stream, SkPDFCatalog* catalog,
bool indirect) {
if (indirect)
@@ -90,7 +104,7 @@
// a 7-bit clean string should require little escaping.
bool sevenBitClean = true;
for (size_t i = 0; i < input.size(); i++) {
- if (input[i] > 0x7F || input[i] < ' ') {
+ if (input[i] & 0x80 || input[i] < ' ') {
sevenBitClean = false;
break;
}
@@ -117,6 +131,7 @@
SkPDFName::SkPDFName(const char name[]) : fValue(formatName(SkString(name))) {}
SkPDFName::SkPDFName(const SkString& name) : fValue(formatName(name)) {}
+SkPDFName::~SkPDFName() {}
void SkPDFName::emitObject(SkWStream* stream, SkPDFCatalog* catalog,
bool indirect) {
@@ -129,12 +144,13 @@
return fValue.size();
}
+// static
SkString SkPDFName::formatName(const SkString& input) {
SkASSERT(input.size() <= kMaxLen);
SkString result("/");
for (size_t i = 0; i < input.size(); i++) {
- if (input[i] > 0x7F || input[i] < '!' || input[i] == '#') {
+ if (input[i] & 0x80 || input[i] < '!' || input[i] == '#') {
result.append("#");
result.appendHex(input[i], 2);
} else {
@@ -145,6 +161,7 @@
return result;
}
+SkPDFArray::SkPDFArray() {}
SkPDFArray::~SkPDFArray() {
fValue.safeUnrefAll();
}
@@ -193,6 +210,7 @@
fValue.push(value);
}
+SkPDFDict::SkPDFDict() {}
SkPDFDict::~SkPDFDict() {
for (int i = 0; i < fValue.count(); i++) {
SkSafeUnref(fValue[i].key);