remove confusing/unused stream methods
BUG=skia:
R=bungeman@google.com, djsollen@google.com
Author: reed@google.com
Review URL: https://codereview.chromium.org/563273003
diff --git a/include/core/SkStream.h b/include/core/SkStream.h
index 516b036..8e3f375 100644
--- a/include/core/SkStream.h
+++ b/include/core/SkStream.h
@@ -81,12 +81,6 @@
SkScalar readScalar();
size_t readPackedUInt();
- /**
- * Reconstitute an SkData object that was written to the stream
- * using SkWStream::writeData().
- */
- SkData* readData();
-
//SkStreamRewindable
/** Rewinds to the beginning of the stream. Returns true if the stream is known
* to be at the beginning after this call returns.
@@ -210,16 +204,6 @@
bool writeStream(SkStream* input, size_t length);
/**
- * Append an SkData object to the stream, such that it can be read
- * out of the stream using SkStream::readData().
- *
- * Note that the encoding method used to write the SkData object
- * to the stream may change over time. This method DOES NOT
- * just write the raw content of the SkData object to the stream.
- */
- bool writeData(const SkData*);
-
- /**
* This returns the number of bytes in the stream required to store
* 'value'.
*/
diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp
index 5d7c2cc..1c2f8e8 100644
--- a/src/core/SkPaint.cpp
+++ b/src/core/SkPaint.cpp
@@ -2307,17 +2307,20 @@
}
#ifndef SK_IGNORE_TO_STRING
+
+static SkFontDescriptor typeface_getDescriptor(const SkTypeface* face) {
+ SkDynamicMemoryWStream ostream;
+ face->serialize(&ostream);
+ SkAutoTUnref<SkStreamAsset> istream(ostream.detachAsStream());
+ return SkFontDescriptor(istream);
+}
+
void SkPaint::toString(SkString* str) const {
str->append("<dl><dt>SkPaint:</dt><dd><dl>");
SkTypeface* typeface = this->getTypeface();
if (typeface) {
- SkDynamicMemoryWStream ostream;
- typeface->serialize(&ostream);
- SkAutoTUnref<SkData> data(ostream.copyToData());
-
- SkMemoryStream stream(data);
- SkFontDescriptor descriptor(&stream);
+ SkFontDescriptor descriptor(typeface_getDescriptor(typeface));
str->append("<dt>Font Family Name:</dt><dd>");
str->append(descriptor.getFamilyName());
diff --git a/src/core/SkStream.cpp b/src/core/SkStream.cpp
index b04bc16..e290b21 100644
--- a/src/core/SkStream.cpp
+++ b/src/core/SkStream.cpp
@@ -64,17 +64,6 @@
}
}
-SkData* SkStream::readData() {
- size_t size = this->readU32();
- if (0 == size) {
- return SkData::NewEmpty();
- } else {
- SkData* data = SkData::NewUninitialized(size);
- this->read(data->writable_data(), size);
- return data;
- }
-}
-
//////////////////////////////////////////////////////////////////////////////////////
SkWStream::~SkWStream()
@@ -189,16 +178,6 @@
return true;
}
-bool SkWStream::writeData(const SkData* data) {
- if (data) {
- this->write32(SkToU32(data->size()));
- this->write(data->data(), data->size());
- } else {
- this->write32(0);
- }
- return true;
-}
-
///////////////////////////////////////////////////////////////////////////////
SkFILEStream::SkFILEStream(const char file[]) : fName(file), fOwnership(kCallerPasses_Ownership) {