aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--include/core/SkStream.h16
-rw-r--r--src/core/SkPaint.cpp15
-rw-r--r--src/core/SkStream.cpp21
3 files changed, 9 insertions, 43 deletions
diff --git a/include/core/SkStream.h b/include/core/SkStream.h
index 516b036a55..8e3f375519 100644
--- a/include/core/SkStream.h
+++ b/include/core/SkStream.h
@@ -81,12 +81,6 @@ public:
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 @@ public:
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 5d7c2cc3eb..1c2f8e83a6 100644
--- a/src/core/SkPaint.cpp
+++ b/src/core/SkPaint.cpp
@@ -2307,17 +2307,20 @@ const SkRect& SkPaint::doComputeFastBounds(const SkRect& origSrc,
}
#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 b04bc162d2..e290b21580 100644
--- a/src/core/SkStream.cpp
+++ b/src/core/SkStream.cpp
@@ -64,17 +64,6 @@ size_t SkStream::readPackedUInt() {
}
}
-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 @@ bool SkWStream::writeStream(SkStream* stream, size_t length) {
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) {